[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    Re: Fix bug 48307
From:       Michael =?iso-8859-1?q?H=E4ckel?= <haeckel () kde ! org>
Date:       2002-10-30 19:16:08
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 30 October 2002 09:59, Carsten Burghardt wrote:
>
> Can you test this? I won't be home until tomorrow and (AFAIK) we
> have a code-freeze.

Ok, what about this patch?
I actually can't reproduce the reported crash, so I'm not sure if it really 
helps, but it should.

Regards,
Michael Häckel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE9wC/8e9KEPyN2R8URAqVpAJ96g8eAZMhu9TuAhla3Bxui+cftPACeOrZx
SIizIjq4Ot45AeZIfr6wuVc=
=IjiE
-----END PGP SIGNATURE-----

["open-close.diff" (text/x-diff)]

Index: kmacctimap.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmacctimap.cpp,v
retrieving revision 1.108
diff -u -3 -p -r1.108 kmacctimap.cpp
--- kmacctimap.cpp	2002/10/11 22:36:19	1.108
+++ kmacctimap.cpp	2002/10/30 19:29:56
@@ -55,6 +55,7 @@ KMAcctImap::KMAcctImap(KMAcctMgr* aOwner
   mCountLastUnread = 0;
   mCountRemainChecks = 0;  
   errorDialogIsActive = false;
+  mOpenFolders.setAutoDelete(true);
   connect(KMBroadcastStatus::instance(), SIGNAL(signalAbortRequested()),
           this, SLOT(slotAbortRequested()));
   connect(&mIdleTimer, SIGNAL(timeout()), SLOT(slotIdleTimeout()));
@@ -280,11 +281,22 @@ void KMAcctImap::initJobData(jobData &jd
 
 
 //-----------------------------------------------------------------------------
+int KMAcctImap::tempOpenFolder(KMFolder *folder)
+{
+  int rc = folder->open();
+  if (rc) return rc;
+  mOpenFolders.append(new QGuardedPtr<KMFolder>(folder));
+  return 0;
+}
+
+
+//-----------------------------------------------------------------------------
 void KMAcctImap::setAutoExpunge(bool aAutoExpunge)
 {
   mAutoExpunge = aAutoExpunge;
 }
 
+
 //-----------------------------------------------------------------------------
 void KMAcctImap::setHiddenFolders(bool aHiddenFolders)
 {
@@ -397,7 +409,13 @@ void KMAcctImap::displayProgress()
     mProgressEnabled = !mapJobData.isEmpty();
     KMBroadcastStatus::instance()->setStatusProgressEnable( "I" + mName,
       mProgressEnabled );
-    if (!mProgressEnabled) kernel->filterMgr()->cleanup();
+    if (!mProgressEnabled)
+    {
+      QPtrListIterator<QGuardedPtr<KMFolder> > it(mOpenFolders);
+      for ( it.toFirst() ; it.current() ; ++it )
+        if (*it) (*(*it))->close();
+      mOpenFolders.clear();
+    }
   }
   mIdle = FALSE;
   if (mapJobData.isEmpty())
Index: kmacctimap.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmacctimap.h,v
retrieving revision 1.48
diff -u -3 -p -r1.48 kmacctimap.h
--- kmacctimap.h	2002/10/11 22:36:19	1.48
+++ kmacctimap.h	2002/10/30 19:29:56
@@ -192,6 +192,11 @@ public:
    */
   static void initJobData(jobData &jd);
 
+  /**
+   * Open a folder and close it again when the network transfer is finished
+   */
+  int tempOpenFolder(KMFolder *folder);
+
 public slots:
   void processNewMail() { processNewMail(TRUE); }
 
@@ -233,6 +238,7 @@ protected:
   KMFolderImap *mFolder;
   int mCountUnread, mCountLastUnread;
   int mCountRemainChecks;
+  QPtrList<QGuardedPtr<KMFolder> > mOpenFolders;
 
 protected slots:
   /**
Index: kmfolder.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmfolder.cpp,v
retrieving revision 1.232
diff -u -3 -p -r1.232 kmfolder.cpp
--- kmfolder.cpp	2002/10/12 12:51:08	1.232
+++ kmfolder.cpp	2002/10/30 19:29:59
@@ -13,7 +13,6 @@
 #include "kmkernel.h"
 #include "identitymanager.h"
 #include "kmidentity.h"
-#include "kmfiltermgr.h"
 
 #include <mimelib/mimepp.h>
 #include <qregexp.h>
@@ -748,7 +747,7 @@ bool KMFolder::canAddMsgNow(KMMessage* a
     connect(imapJob, SIGNAL(messageRetrieved(KMMessage*)),
       SLOT(reallyAddMsg(KMMessage*)));
     aMsg->setTransferInProgress(TRUE);
-    kernel->filterMgr()->tempOpenFolder(this);
+    static_cast<KMFolderImap*>(msgParent)->account()->tempOpenFolder(this);
     return FALSE;
   }
   return TRUE;
Index: kmfolderimap.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmfolderimap.cpp,v
retrieving revision 1.73
diff -u -3 -p -r1.73 kmfolderimap.cpp
--- kmfolderimap.cpp	2002/10/15 19:49:02	1.73
+++ kmfolderimap.cpp	2002/10/30 19:30:03
@@ -211,6 +211,7 @@ int KMFolderImap::addMsg(KMMessage* aMsg
 
 int KMFolderImap::addMsg(QPtrList<KMMessage>& msgList, int* aIndex_ret)
 {
+  mAccount->tempOpenFolder(this);
   KMMessage *aMsg = msgList.getFirst();
   KMFolder *msgParent = aMsg->parent();
 
@@ -221,6 +222,7 @@ int KMFolderImap::addMsg(QPtrList<KMMess
   KMImapJob *imapJob = 0;
   if (msgParent)
   {
+    mAccount->tempOpenFolder(msgParent);
     if (msgParent->protocol() == "imap")
     {
       if (static_cast<KMFolderImap*>(msgParent)->account() == account())
@@ -297,6 +299,13 @@ int KMFolderImap::addMsg(QPtrList<KMMess
 //-----------------------------------------------------------------------------
 void KMFolderImap::copyMsg(QPtrList<KMMessage>& msgList)
 {
+  mAccount->tempOpenFolder(this);
+  KMMessage *aMsg = msgList.getFirst();
+  if (aMsg)
+  {
+    KMFolder* parent = aMsg->parent();
+    if (parent) mAccount->tempOpenFolder(parent);
+  }
   QValueList<int> uids;
   getUids(msgList, uids);
   QStringList sets = makeSets(uids, false);

_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic