[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    BUG: KStaticDeleters cleaned up too soon
From:       richedw () vodafone ! es
Date:       2004-09-15 5:00:47
Message-ID: 200409150700.47964.richedw () vodafone ! es
[Download RAW message or body]

I originally reported this as BUG 89333 =>KStaticDeleter crashes Kate on quit.
This bug is crashing applications all over and it is being fixed at the wrong 
places.
I have traced it to the ~KApplication destructor when quitting .
KGlobal::deleteStaticDeleters() deletes the all the Static Deleters and next
KLibLoader::cleanUp() cleans up left-overs objects, which may in their 
destructor
try to access a static deleter that is no longer there.
KLibLoader::cleanUp shold be called first unless there is a good reason not 
to,
otherwise best avoid KStaticDeleter for factory singletons.
The coding of the KStaticDeleter itself is much to blame as once created it 
sets
a global variable and doesn't check for deletion.

For instance in KateDocument destructor:
	KateFactory::Self()->unregisterDocuments()
this tries to access the factory held in a static deleter that's already gone 
and crashes.
see BUG 89333 for full explanation.

In KONQUEROR same thing happens...

KFileMetaInfoProvider * KFileMetaInfoProvider::self()
{
    if ( !s_self )
        s_self = sd.setObject( s_self, new KFileMetaInfoProvider() );

    return s_self;
}

KFileMetaInfoProvider::~KFileMetaInfoProvider()
{
    sd.setObject( 0 );     // sd has been deleted!!!
}

you'll see similar backtraces all over the place.

[New Thread 16384 (LWP 2593)]
[KCrash handler]
#4  0x2f656c61 in ?? ()
#5  0x4049e17e in QDict<KFilePlugin>::deleteItem(void*) ()
   from /usr/local/kde/lib/libkio.so.4
#6  0x41220b4a in QGDict::clear() (this=0x83f6198) at tools/qgdict.cpp:783
#7  0x4049cc4c in QDict<KFilePlugin>::clear() ()
   from /usr/local/kde/lib/libkio.so.4
#8  0x4049bbc8 in QDict<KFilePlugin>::~QDict() ()
   from /usr/local/kde/lib/libkio.so.4
#9  0x404971a6 in KFileMetaInfoProvider::~KFileMetaInfoProvider() ()
   from /usr/local/kde/lib/libkio.so.4
#10 0x4049e963 in KStaticDeleter<KFileMetaInfoProvider>::destructObject() ()
   from /usr/local/kde/lib/libkio.so.4
#11 0x40a3b69a in KGlobal::deleteStaticDeleters() () at kglobal.cpp:189
#12 0x409a3d61 in ~KApplication (this=0xbffff4e0) at kapplication.cpp:1572
#13 0x4006d2b4 in kdemain () from /usr/local/kde/lib/libkdeinit_konqueror.so
#14 0x08048697 in main ()

I send this to you because I saw you refer to it on the list.
Cheers David.

Richard Edwards (grizzly).

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic