Date: prev next · Thread: first prev next last
2016 Archives by date, by thread · List index


Hey

On Sun, Jan 3, 2016 at 9:20 AM, Chris Sherlock <chris.sherlock79@gmail.com>
wrote:

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...


I can only help you with the C++ part but not explain why it makes sense to
call that code.

The code calls SwFormat::GetRegisteredIn which is actually
SwClient::GetRegisteredIn (through the inheritance hierarchy
SwFormat->SwModify->SwClient). SwClient::GetRegisteredIn returns a pointer
to a SwModify where the code actually assumes that it always returns a
SwFormat.



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!



It looks a bit like it is using some generic writer code to store the
inheritance of the styles.



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


That depends on all the code around it. Here the code just assumes that all
returned SwModify objects are actually SwFormat objects.



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

Chris

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice



Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.