[PATCH] Fix for bug 147036 (KGlobalAccel dtor crashes during app shutdown)
Michael Pyne
michael.pyne at kdemail.net
Sun Jun 24 15:49:06 BST 2007
On Sunday 24 June 2007, Matthias Kretz wrote:
> Hi,
>
> On Sunday 24 June 2007, Michael Pyne wrote:
> > Could someone review the following patch for bug 147036
> > (http://bugs.kde.org/show_bug.cgi?id=147036) ?
>
> It's not necessary to add anything to KApplication. QApplication does all
> we need already.
I noticed qAddPostRoutine but I thought it was not called until the
QCoreApplication constructor. Diving into the code reveals I was wrong. :)
> Last time I showed my patch on #kde4-devel Thiago and I kept going in
> circles about why we need a post routine, remove the post routine when
> called from lib unload and whether a K_GLOBAL_STATIC is necessary there at
> all. Short explanation why I think it we should do all that:
> 1. kdeui is unloaded before ~QApplication is called (this won't happen
> using KLibLoader, but QLibrary::unload() really calls dlclose)
> => global static is deleted using the K_GLOBAL_STATIC mechanism: then
> the post routine has to be removed, otherwise the app will keep a dangling
> function pointer and call it from ~QApplication
> 2. normal application shutdown: the post routine is called from
> ~QApplication and the K_GLOBAL_STATIC cleanup will call "delete 0"
I will also note that the Qt docs are pretty clear that you should call the
qRemovePostRoutine in the destroy function you passed to qAddPostRoutine,
like you do. I think your patch manages to exceed my own.
Regards,
- Michael Pyne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070624/80a2a746/attachment.sig>
More information about the kde-core-devel
mailing list