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


On Wednesday 04 of April 2012, Tor Lillqvist wrote:
commit 2b00b0e0a1a47c3d174ee9e86826b60a356f3dbf
Author: Tor Lillqvist <tml@iki.fi>
Date:   Tue Apr 3 23:45:26 2012 +0300

    WaE: call to pure virtual member function

diff --git a/framework/source/classes/menumanager.cxx
b/framework/source/classes/menumanager.cxx index 4b0af60..202b7eb 100644
--- a/framework/source/classes/menumanager.cxx
+++ b/framework/source/classes/menumanager.cxx
@@ -146,8 +146,14 @@ MenuManager::MenuManager(
     m_xFrame            = rFrame;
     m_bInitialized      = sal_False;
     m_bIsBookmarkMenu   = sal_False;
+#ifdef LIBO_WERROR
+    // Wtf? Clang says: call to pure virtual member function
+    // 'acquire'; overrides of 'acquire' in subclasses are not
+    // available in the constructor of 'XInterface'

 This is 
http://stackoverflow.com/questions/496440/c-virtual-function-from-constructor 
(or http://www.artima.com/cppsource/nevercall.html if you want it in more 
detail, although the 'never' is a bit far-fetched, it is well-defined what 
happens).

+    assert(!"Call to pure virtual member function");
+#else
     SAL_STATIC_CAST( ::com::sun::star::uno::XInterface*,
(OWeakObject*)this )->acquire(); -
+#endif

 However this appears to a Clang bug, in that it reports an incorrect warning, 
probably it gets confused by the casts. I cannot actually trigger this code 
to run, but in my small testcase, code like this generated the warning, but 
worked normally. So I expect that whenever somebody actually reaches this 
code, this will assert needlessly.

 I'm not sure what the proper fix would be though, as the class apparently 
inherits from XInterface in 3 different ways, and I wonder what the point of 
the explicit casts is. I'll go with thinking the casts are pointless historic 
garbage and try plain call to acquire(), it shouldn't make it worse.

-- 
 Lubos Lunak
 l.lunak@suse.cz

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.