Hi Joe, On 19 July 2011 06:40, Joseph Powers <jpower...@cox.net> wrote: > I'd like someone doing a Unix build to review this for me. I compile Mac and > this is Unix only code so I don't just want to push and hope... > First I thought it would compile and want just to write something but then I tried and it doesn't. But my question is: Would not it be better to replace List with std::list ? Or if vector I don't like erase because it's not effective. In this case I'd use maBmpList.pop_back(). On the first sight I thought you have mistake in:
void ImplSalBitmapCache::ImplRemove( X11SalBitmap* pBmp ) { - for( ImplBmpObj* pObj = (ImplBmpObj*) maBmpList.Last(); pObj; pObj = (ImplBmpObj*) maBmpList.Prev() ) + for( size_t i = maBmpList.size(); i; ) { + ImplBmpObj* pObj = maBmpList[ --i ]; if( pObj->mpBmp == pBmp ) { - maBmpList.Remove( pObj ); + maBmpList.erase( maBmpList.begin() + i ); pObj->mpBmp->ImplRemovedFromCache(); mnTotalSize -= pObj->mnMemSize; delete pObj; But then I realized you are decreasing i in ImplBmpObj* pObj = maBmpList[ --i ]; So - maBmpList.erase( maBmpList.begin() + i ); is in fact pop_back and it's effective but personally I'd use the latter to avoid mistakes. Now here is what I got on 32bit Ubuntu: vcl/unx/generic/gdi/salbmp.cxx: In member function ‘void ImplSalBitmapCache::ImplAdd(X11SalBitmap*, sal_uLong, sal_uLong)’: vcl/unx/generic/gdi/salbmp.cxx:1218: error: invalid use of incomplete type ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/inc/unx/salbmp.h:253: error: forward declaration of ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/unx/generic/gdi/salbmp.cxx:1226: error: invalid use of incomplete type ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/inc/unx/salbmp.h:253: error: forward declaration of ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/unx/generic/gdi/salbmp.cxx:1227: error: invalid use of incomplete type ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/inc/unx/salbmp.h:253: error: forward declaration of ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/unx/generic/gdi/salbmp.cxx:1227: error: invalid use of incomplete type ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/inc/unx/salbmp.h:253: error: forward declaration of ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/unx/generic/gdi/salbmp.cxx:1230: error: invalid use of incomplete type ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/inc/unx/salbmp.h:253: error: forward declaration of ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/unx/generic/gdi/salbmp.cxx: In member function ‘void ImplSalBitmapCache::ImplRemove(X11SalBitmap*)’: vcl/unx/generic/gdi/salbmp.cxx:1240: error: invalid use of incomplete type ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/inc/unx/salbmp.h:253: error: forward declaration of ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/unx/generic/gdi/salbmp.cxx:1243: error: invalid use of incomplete type ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/inc/unx/salbmp.h:253: error: forward declaration of ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/unx/generic/gdi/salbmp.cxx:1244: error: invalid use of incomplete type ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/inc/unx/salbmp.h:253: error: forward declaration of ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/unx/generic/gdi/salbmp.cxx:1245: warning: possible problem detected in invocation of delete operator: vcl/unx/generic/gdi/salbmp.cxx:1239: warning: ‘pObj’ has incomplete type vcl/inc/unx/salbmp.h:253: warning: forward declaration of ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/unx/generic/gdi/salbmp.cxx:1245: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined. vcl/unx/generic/gdi/salbmp.cxx: In member function ‘void ImplSalBitmapCache::ImplClear()’: vcl/unx/generic/gdi/salbmp.cxx:1257: error: invalid use of incomplete type ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/inc/unx/salbmp.h:253: error: forward declaration of ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/unx/generic/gdi/salbmp.cxx:1258: warning: possible problem detected in invocation of delete operator: vcl/unx/generic/gdi/salbmp.cxx:1258: warning: invalid use of incomplete type ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/inc/unx/salbmp.h:253: warning: forward declaration of ‘struct ImplSalBitmapCache::ImplBmpObj’ vcl/unx/generic/gdi/salbmp.cxx:1258: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined. I was not investigating where the problem is, I think you can handle it. All the best, Matus _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice