Problem with applications which have a system tray applet and secondary windows

David Faure faure at kde.org
Sun Dec 21 12:50:59 GMT 2003


On Sunday 07 December 2003 23:58, Ingo Klöcker wrote:
> > Why not simply call kapp->ref() from the systemtray (your derived
> > class for now, the base one in kde-4 maybe), and deref in the dtor?
> >
> > Then the user has to close the systray thingie by whichever way,
> > before the process exits.
> 
> Hah! I'm glad I'm not the only one that makes this mistake. That's what 
> I tried first after I found out about kapp->ref(). But it doesn't work. 
> Now, think again and tell me why it won't work. ;-)
> 
> Hint: kapp->deref() is called each time a last visible window is closed. 
> And you can close a last visible window more than once.

You're right, there's something missing. I just had a thought about this, and:
when creating a first new KMainWindow after that "deref" call, it should call
ref again somehow.

So maybe a simpler way would be that every KMainWindow calls ref in its ctor
and deref in its dtor. This is much simpler, cleaner, and should work, no?

I can't think of a case that contradicts this. kmail's composer window should
remain open when closing the reader mainwindow, for instance, so it's normal
that it would keep its own ref on kapp.

-- 
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