gcc 3.3.4 and KStaticDeleter

Aaron J. Seigo aseigo at kde.org
Mon Nov 29 10:16:15 GMT 2004


hey all...

i seem to have run into a nasty little problem with KStaticDeleter and newer 
gcc's. the following code can be seen in 
kdebase/kicker/core/extensionmanager.cpp:

static KStaticDeleter<ExtensionManager> extensionManagerDeleter;
ExtensionManager* ExtensionManager::m_self = 0;

ExtensionManager* ExtensionManager::the()
{
    if (!m_self)
    {
        extensionManagerDeleter.setObject(m_self, new ExtensionManager());
    }

    return m_self;
}

with gcc 3.3.4 (or at least, the one in SUSE 9.2 and, i believe, in FC3) and 
beyond, calls to ExtensionManager::the() work just fine and as expected until 
it is called from ChildPanelExtension. this is a KPanelExtension that is 
dynamically loaded at run time, and when it calls ExtensionManager::the() it 
causes a NEW ExtensionManager to be created!

if this:

	extensionManagerDeleter.setObject(m_self, new ExtensionManager());

is changed to:

	m_self = new ExtensionManager();

all is well. however, without the KStaticDeleter, newly applets/extensions 
won't survive a logout/login because that voodoo requires that extensions 
actually get deleted and run the clean up routines in the dtor. in any case, 
this seems to be a larger problem that just "it doesn't work in kicker" since 
it _used_ to work just fine and works just fine as a singleton if i don't use 
KStaticDeleter (which i need to)

this doesn't seem to be visibility related since SUSE 9.2 doesn't have the 
visibility patches in it.

does anyone have any idea what may be breaking KStaticDeleter with gcc 3.3.4?

-- 
Aaron J. Seigo
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20041129/63d5f881/attachment.sig>


More information about the kde-core-devel mailing list