SwFormat::DerviedFrom()

Chris Sherlock chris.sherlock79 at gmail.com
Sun Jan 3 00:20:12 PST 2016


Hi all, 

I’ve been getting an OSL_ENSURE failure when I run LibreOffice on my Ubuntu Linux VM. 

The error is:

warn:legacy.osl:25546:1:sw/source/core/attr/format.cxx:227: SwFormat::~SwFormat: Def dependents!

This appears to be occuring because the OSL_ENSURE is calling on DerivedFrom(), which actually returns the following:

return const_cast <http://opengrok.libreoffice.org/s?defs=const_cast&project=core><SwFormat <http://opengrok.libreoffice.org/xref/core/sw/inc/format.hxx#SwFormat>*>(static_cast <http://opengrok.libreoffice.org/s?defs=static_cast&project=core><const SwFormat <http://opengrok.libreoffice.org/xref/core/sw/inc/format.hxx#SwFormat>*>(GetRegisteredIn <http://opengrok.libreoffice.org/s?defs=GetRegisteredIn&project=core>()));

GetRegisteredIn() is just an event source of type SwModify, the odd thing is that it calls on GetRegistedIn() which is NOT a member of SwModify (or any child classes). 

In fact, I’m surprised that this even compiles, as I was under the impression that a static_cast was a compile time check...

http://opengrok.libreoffice.org/xref/core/sw/inc/format.hxx#110 <http://opengrok.libreoffice.org/xref/core/sw/inc/format.hxx#110>

Anyway, what *exactly* is this attempting to do? The name looks like it’s doing a debugging check to ensure that the SwFormat class was registered in a derived class, but I can’t see how this would ever work!

In fact, wouldn’t a dynamic_cast be better, as this most specifically down or upcasts a pointer, and returns NULL if it fails?

Any advise on this would be greatly appreciated, got me thoroughly tricked...

Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20160103/f943ce2b/attachment.html>


More information about the LibreOffice mailing list