[kdepim-users] empty-trash-on-exit logic
René J.V. Bertin
rjvbertin at gmail.com
Tue Nov 11 19:53:30 GMT 2014
Hi,
I have configured KMail to empty my local trash on exit, but not for instance the trashes of my GMail accounts because those are taken care of by GMail itself.
I've noticed that KMail often "hangs" on exit, sometimes indefinitely like when I quit to get out of the frozen "Retrieving Folder Contents" issue that's plaguing me. When I check with a debugger, the process is deadlocked somewhere under the jobStatistics->exec() call in the following block from KMKernel::cleanup :
if ( GlobalSettings::self()->emptyTrashOnExit() ) {
Akonadi::CollectionStatisticsJob *jobStatistics = new Akonadi::CollectionStatisticsJob( trashCollection );
if ( jobStatistics->exec() ) {
if ( jobStatistics->statistics().count() > 0 ) {
mFolderCollectionMonitor->expunge( trashCollection, true /*sync*/ );
}
}
}
According to the documentation of the emptyTrashOnExit() function, it returns True only if the *local* trashcan is set to be emptied on exit.
So when this is the case, KMail will first obtain statistics on *all* trash folders, and only then do an expunge.
I see several issues with this. First, this block works on the trashCollection, I don't see how it could work on only the local wastebin. Nor how it excludes any other trashes from expunging, by the way. Shouldn't the expunge() be done on jobStatistics->collection() instead of trashCollection?
Second, it seems to gather statistics regardless of which trashes should be emptied. It would be more economical to gather statistics only on those folders which actually ought to be emptied.
Lastly, there is no timeout foreseen. (GMail) trash folders can become very big, internet speeds can slow down to a crawl and those are just 2 reasons why jobStatistics->exec() can take a very long time to complete even if the app is not in deadlock. That leaves KMail "hanging in limbo", without any sign that it's still running if the user hasn't activated the systray icon. Correction: there is 1 sign: you cannot start another KMail instance during that time; attempts will fail silently instead without as much as a warning dialog.
All that for a procedure that isn't *that* important.
I'd suggest that at the very least there ought to be a timeout on the statistics job, but a small progress/activity popup that says something like "emptying wastebin(s)" and that has a cancel button to interrupt to process would be much nicer.
Thoughts?
René
_______________________________________________
KDE PIM users mailing list
Subscription management: https://mail.kde.org/mailman/listinfo/kdepim-users
More information about the kdepim-users
mailing list