[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kdecore
From: David Faure <faure () kde ! org>
Date: 2011-01-17 0:39:10
Message-ID: 20110117003910.14080AC8B5 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1214954 by dfaure:
Found how to reproduce the qfswatch hang bug in the unittest.
Fixed by adding a qAddPostRoutine which destroys KDirWatch::sef() while qApp is still around.
If this proves stable in trunk, let's backport it to the 4.6 branch
CCBUG: 261541
M +16 -1 io/kdirwatch.cpp
M +11 -0 tests/kdirwatch_unittest.cpp
--- trunk/KDE/kdelibs/kdecore/io/kdirwatch.cpp #1214953:1214954
@@ -54,6 +54,7 @@
#include <QtCore/QFile>
#include <QtCore/QSocketNotifier>
#include <QtCore/QTimer>
+#include <QtCore/QCoreApplication>
#include <ksharedconfig.h>
#include <kdebug.h>
@@ -680,6 +681,7 @@
return true;
}
+ kDebug(7001) << "inotify failed for monitoring" << e->path << ":" << strerror(errno);
return false;
}
#endif
@@ -1723,11 +1725,17 @@
return s_pKDirWatchSelf;
}
+// TODO KDE5: is this used anywhere?
bool KDirWatch::exists()
{
- return s_pKDirWatchSelf != 0;
+ return s_pKDirWatchSelf.exists();
}
+static void cleanupKDirWatch()
+{
+ s_pKDirWatchSelf.destroy();
+}
+
KDirWatch::KDirWatch (QObject* parent)
: QObject(parent), d(createPrivate())
{
@@ -1739,7 +1747,14 @@
d->ref();
d->_isStopped = false;
+
+ static bool cleanupRegistered = false;
+ if (!cleanupRegistered) {
+ cleanupRegistered = true;
+ // Must delete kdirwatch before qApp is gone, due to QFileSystemWatcher - bug 261541
+ qAddPostRoutine(cleanupKDirWatch);
}
+}
KDirWatch::~KDirWatch()
{
--- trunk/KDE/kdelibs/kdecore/tests/kdirwatch_unittest.cpp #1214953:1214954
@@ -91,6 +91,7 @@
void watchAndModifyOneFile();
void removeAndReAdd();
void watchNonExistent();
+ void watchNonExistentWithSingleton();
void testDelete();
void testDeleteAndRecreateFile();
void testDeleteAndRecreateDir();
@@ -434,6 +435,16 @@
QVERIFY(waitForOneSignal(watch, SIGNAL(dirty(QString)), subdir));
}
+void KDirWatch_UnitTest::watchNonExistentWithSingleton()
+{
+ const QString file = "/root/.ssh/authorized_keys";
+ KDirWatch::self()->addFile(file);
+ // When running this test in KDIRWATCHTEST_METHOD=QFSWatch, or when FAM is not available
+ // and we fallback to qfswatch when inotify fails above, we end up creating the fsWatch
+ // in the kdirwatch singleton. Bug 261541 discovered that Qt hanged when deleting fsWatch
+ // once QCoreApp was gone, this is what this test is about.
+}
+
void KDirWatch_UnitTest::testDelete()
{
const QString file1 = m_path + "del";
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic