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

List:       kde-commits
Subject:    [kdepim] /: Make sure to flush the foldercollection cache before kernel destruction.
From:       Till Adam <till () kdab ! com>
Date:       2012-02-21 14:06:34
Message-ID: 20120221140634.099A1A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 7b76706c92a6fdfaa8a190334fa0819d36e98fc7 by Till Adam.
Committed on 21/02/2012 at 15:03.
Pushed by tilladam into branch 'master'.

Make sure to flush the foldercollection cache before kernel destruction.

M  +4    -0    kmail/kmkernel.cpp
M  +6    -0    mailcommon/foldercollection.cpp
M  +1    -0    mailcommon/foldercollection.h

http://commits.kde.org/kdepim/7b76706c92a6fdfaa8a190334fa0819d36e98fc7

diff --git a/kmail/kmkernel.cpp b/kmail/kmkernel.cpp
index c4501ac..d3757f0 100644
--- a/kmail/kmkernel.cpp
+++ b/kmail/kmkernel.cpp
@@ -1237,6 +1237,10 @@ void KMKernel::cleanup(void)
   the_shuttingDown = true;
   closeAllKMailWindows();
 
+  // Flush the cache of foldercollection objects. This results
+  // in configuration writes, so we need to do it early enough.
+  MailCommon::FolderCollection::clearCache();
+
   // Write the config while all other managers are alive
   delete the_msgSender;
   the_msgSender = 0;
diff --git a/mailcommon/foldercollection.cpp b/mailcommon/foldercollection.cpp
index 91b3a83..36ab3b3 100644
--- a/mailcommon/foldercollection.cpp
+++ b/mailcommon/foldercollection.cpp
@@ -82,6 +82,12 @@ FolderCollection::~FolderCollection()
   }
 }
 
+void FolderCollection::clearCache()
+{
+  QMutexLocker lock( &mapMutex );
+  fcMap.clear();
+}
+
 bool FolderCollection::isWriteConfig() const
 {
   return mWriteConfig;
diff --git a/mailcommon/foldercollection.h b/mailcommon/foldercollection.h
index 9d2ce84..68dd6b7 100644
--- a/mailcommon/foldercollection.h
+++ b/mailcommon/foldercollection.h
@@ -46,6 +46,7 @@ class MAILCOMMON_EXPORT FolderCollection : public QObject
     void setCollection( const Akonadi::Collection &collection );
 
     static QString configGroupName( const Akonadi::Collection &col );
+    static void clearCache();
 
     bool isWriteConfig() const;
     void setWriteConfig( bool writeConfig );
[prev in list] [next in list] [prev in thread] [next in thread] 

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