Bug 163479 - Closing any window while KMail is minimized to the tray will quit the app
Summary: Closing any window while KMail is minimized to the tray will quit the app
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.9.51
Platform: unspecified Linux
: NOR major
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 163154 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-06-07 20:24 UTC by Andrew Belitsky
Modified: 2008-07-13 14:49 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Belitsky 2008-06-07 20:24:54 UTC
Version:           1.9.51 (using 4.00.81 (KDE 4.0.81 >= 20080527), compiled sources)
Compiler:          gcc
OS:                Linux (i686) release 2.6.25-ARCH

KMail quits fter these steps:
1. start kmail;
2. click "new" button to create new message;
3. then close main window to tray;
4. and finnaly close message window.
Comment 1 Thomas McGuire 2008-06-07 20:36:42 UTC
*** Bug 163154 has been marked as a duplicate of this bug. ***
Comment 2 Thomas McGuire 2008-06-07 20:37:31 UTC
Confirmed. Probably a regression in Qt4.4, the behaviour of quitOnLastWindowClosed() seems to have changed.
Comment 3 Thomas McGuire 2008-07-09 14:54:10 UTC
OK, here's what dfaure suggested on IRC:

1. disable Qt's quitOnLastWindowClosed() in KMail and Kontact
2. Make it optional that KJobs do KGlobal::ref()/deref()
        -> KJob::allowQuitWhileJobsAreRunning(bool)
3. KGlobal::deref() will then take care of quitting the event loop.
   Both the mainwindows and the systemtray hold refs.

Instead of 1), it might also be possible to disable the WA_QuitOnClose flags for KDE mainwindows.

I'll need to investigate which jobs shouldn't be killed when quitting KMail, those jobs should call ref().
Comment 4 David Faure 2008-07-09 15:12:03 UTC
2) is not needed after all; the abortMailCheck and cancelMailCheck in the kmmainwin and kmailpart destructors take care of allowing kmail to quit even while a mailcheck is happening.
Comment 5 Thomas McGuire 2008-07-09 17:06:56 UTC
SVN commit 830027 by tmcguire:

Fix detection when to quit the main loop, by disabling Qt's quitOnLastWindowClosed(),
which would cause KMail to exit when the user OK'd a message box while KMail was
mimimized to the systray.

Implement cancelMailCheck() for POP accounts, so that those stop when quitting
KMail.

Also abort mail checks when using File->Quit in the menu and the systray is active.

BUG: 163479


 M  +2 -2      kmail/kmcommands.cpp  
 M  +1 -1      kmail/kmmainwin.cpp  
 M  +7 -0      kmail/main.cpp  
 M  +6 -0      kmail/popaccount.cpp  
 M  +5 -0      kmail/popaccount.h  
 M  +8 -0      kontact/src/main.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=830027
Comment 6 Thomas McGuire 2008-07-13 14:49:43 UTC
SVN commit 831845 by tmcguire:

Also quit the event loop when a part still holds a reference to a KGlobal object,
probably by a KJob which wasn't properly deleted.

This fixes that the Kontact process was still running (without a window) after viewing
an article in Akregator.

The real fix would be to fix Akregator, it should take care of properly cleaning
up each KJob.

@David: maybe KJob::allowQuitWhileJobsAreRunning(bool) wasn't such a bad idea after all?

CCBUG: 163479
BUG: 166367


 M  +6 -0      mainwindow.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=831845