[PATCH] KApplication's refcounting woes
David Faure
faure at kde.org
Sun Oct 5 13:19:56 BST 2003
On Sunday 05 October 2003 14:13, Martijn Klingens wrote:
> While trying to make Kopete's plugin unloading on exit async I wanted to add
> an extra ref() to the KApplication object to make sure the plugin manager
> outlives the main window. This works, and when my handler is called it
> successfully derefs the app.
>
> However, after I deref the app it's still using a refcount of 1 instead of 0
> and doesn't terminate.
>
> kapplication.cpp contains a comment:
>
> ----
> /**
> * This counter indicates when to exit the application.
> * It starts at 1, is decremented by the "last window close" event, but
> * is incremented by operations that should outlive the last window closed
> * (e.g. a file copy for a file manager, or 'compacting folders on exit' for
> * a mail client).
> */
> int refCount;
> ----
>
> Although the comment says so KApplication does _NOT_ deref on
> latWindowClosed().
KMainWindow does it.
See kmainwindow.cpp:584.
This patch is wrong, since it'll do it twice, with KMainWindows.
Are you using kmainwindow?
--
David FAURE, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kde-core-devel
mailing list