<div dir="ltr">Hey<br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 3, 2016 at 9:20 AM, Chris Sherlock <span dir="ltr"><<a href="mailto:chris.sherlock79@gmail.com" target="_blank">chris.sherlock79@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi all, <div><br></div><div>I’ve been getting an OSL_ENSURE failure when I run LibreOffice on my Ubuntu Linux VM. </div><div><br></div><div>The error is:</div><div><br></div><div><div>warn:legacy.osl:25546:1:sw/source/core/attr/format.cxx:227: SwFormat::~SwFormat: Def dependents!</div></div><div><br></div><div>This appears to be occuring because the OSL_ENSURE is calling on DerivedFrom(), which actually returns the following:</div><div><br></div><div><pre style="padding:0px;margin-top:0px;margin-bottom:0px;line-height:normal;background-color:rgb(255,255,255)"><b>return</b> <a href="http://opengrok.libreoffice.org/s?defs=const_cast&project=core" style="color:rgb(16,88,2);text-decoration:none" target="_blank">const_cast</a><<a href="http://opengrok.libreoffice.org/xref/core/sw/inc/format.hxx#SwFormat" style="color:rgb(153,0,153);text-decoration:none" target="_blank">SwFormat</a>*>(<a href="http://opengrok.libreoffice.org/s?defs=static_cast&project=core" style="color:rgb(16,88,2);text-decoration:none" target="_blank">static_cast</a><<b>const</b> <a href="http://opengrok.libreoffice.org/xref/core/sw/inc/format.hxx#SwFormat" style="color:rgb(153,0,153);text-decoration:none" target="_blank">SwFormat</a>*>(<a href="http://opengrok.libreoffice.org/s?defs=GetRegisteredIn&project=core" style="color:rgb(16,88,2);text-decoration:none" target="_blank">GetRegisteredIn</a>()));</pre><div><br></div></div><div>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). </div><div><br></div><div>In fact, I’m surprised that this even compiles, as I was under the impression that a static_cast was a compile time check...</div></div></blockquote><div><br></div><div>I can only help you with the C++ part but not explain why it makes sense to call that code.<br><br></div><div>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.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div><a href="http://opengrok.libreoffice.org/xref/core/sw/inc/format.hxx#110" target="_blank">http://opengrok.libreoffice.org/xref/core/sw/inc/format.hxx#110</a></div><div><br></div><div>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!</div></div></blockquote><div><br><br></div><div>It looks a bit like it is using some generic writer code to store the inheritance of the styles.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>In fact, wouldn’t a dynamic_cast be better, as this most specifically down or upcasts a pointer, and returns NULL if it fails?</div></div></blockquote><div><br></div><div>That depends on all the code around it. Here the code just assumes that all returned SwModify objects are actually SwFormat objects.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>Any advise on this would be greatly appreciated, got me thoroughly tricked...</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Chris</div></font></span></div><br>_______________________________________________<br>
LibreOffice mailing list<br>
<a href="mailto:LibreOffice@lists.freedesktop.org">LibreOffice@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/libreoffice" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/libreoffice</a><br>
<br></blockquote></div><br></div></div>