[Bug 126715] Crash after fresh startup and selecting mail

Stephan Kulow <[email protected]>
Newsgroups gmane.comp.kde.devel.kmail
Message-ID <[email protected]>
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=126715         




------- Additional Comments From coolo kde org  2007-03-16 13:05 -------
The selected folder is closed and on reopen the current messages are deleted. There is code that tries to prevent this, but I'm afraid it does not work.
The mOpenCount is decresed, which will cause later ::open calls to think the folder is closed - even though the file is still open.

Index: kmfolderimap.cpp
===================================================================
--- kmfolderimap.cpp    (Revision 642736)
+++ kmfolderimap.cpp    (Arbeitskopie)
 @ -109,13 +109,13  @
 void KMFolderImap::close(bool aForced)
 {
   if (mOpenCount <= 0 ) return;
-  if (mOpenCount > 0) mOpenCount--;
-  if (mOpenCount > 0 && !aForced) return;
+  if (mOpenCount - 1 > 0 && !aForced) return;
   if (isSelected() && !aForced) {
       kdWarning(5006) << "Trying to close the selected folder " << label() <<
           " - ignoring!" << endl;
       return;
   }
+  if (mOpenCount > 0) mOpenCount--;
   // FIXME is this still needed?
   if (mAccount)
     mAccount->ignoreJobsForFolder( folder() );
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.