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

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/io
From:       David Faure <faure () kde ! org>
Date:       2011-01-18 18:41:42
Message-ID: 20110118184142.94BE2AC8B6 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1215435 by dfaure:

Apply better fix for the use of KDirWatch::self() in the destructor of a singleton:
 make it possible, by not destroying the KDirWatch early, only its qfswatcher.
Patch by alter schwede, thanks!
CCBUG: 261541


 M  +10 -4     kdirwatch.cpp  
 M  +2 -0      kdirwatch.h  


--- trunk/KDE/kdelibs/kdecore/io/kdirwatch.cpp #1215434:1215435
@@ -1731,9 +1731,9 @@
   return s_pKDirWatchSelf.exists();
 }
 
-static void cleanupKDirWatch()
+static void cleanupQFSWatcher()
 {
-  s_pKDirWatchSelf.destroy();
+  s_pKDirWatchSelf->deleteQFSWatcher();
 }
 
 KDirWatch::KDirWatch (QObject* parent)
@@ -1751,8 +1751,8 @@
     static bool cleanupRegistered = false;
     if (!cleanupRegistered) {
         cleanupRegistered = true;
-        // Must delete kdirwatch before qApp is gone, due to QFileSystemWatcher - bug 261541
-        qAddPostRoutine(cleanupKDirWatch);
+        // Must delete QFileSystemWatcher before qApp is gone - bug 261541
+        qAddPostRoutine(cleanupQFSWatcher);
     }
 }
 
@@ -1856,6 +1856,12 @@
   return false;
 }
 
+void KDirWatch::deleteQFSWatcher()
+{
+  delete d->fsWatcher;
+  d->fsWatcher = 0;
+}
+
 void KDirWatch::statistics()
 {
   if (!dwp_self) {
--- trunk/KDE/kdelibs/kdecore/io/kdirwatch.h #1215434:1215435
@@ -212,6 +212,8 @@
     */
    bool contains( const QString& path ) const;
 
+   void deleteQFSWatcher();
+
    /**
     * Dump statistic information about the KDirWatch::self() instance.
     * This checks for consistency, too.
[prev in list] [next in list] [prev in thread] [next in thread] 

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