[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.4/kdelibs/kio/kio
From: David Faure <faure () kde ! org>
Date: 2010-02-15 22:03:34
Message-ID: 1266271414.847998.32237.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1090729 by dfaure:
Fix the "kdirwatch crash on re-entrancy from the slots" by emitting the signals in a delayed manner.
Fixed for: 4.4.1
BUG: 224229 208486 226674 222547
M +21 -9 kdirwatch.cpp
M +20 -16 kdirwatch.h
M +2 -0 kdirwatch_p.h
--- branches/KDE/4.4/kdelibs/kio/kio/kdirwatch.cpp #1090728:1090729
@@ -500,6 +500,18 @@
return ret;
}
+QDebug operator<<(QDebug debug, const KDirWatchPrivate::Entry &entry)
+{
+ debug.space() << entry.path << (entry.isDir ? "dir" : "file");
+ if (entry.m_status == KDirWatchPrivate::NonExistent)
+ debug << "NonExistent";
+ debug << "mode:" << entry.m_mode
+ << entry.m_clients.count() << "clients";
+ if (!entry.m_entries.isEmpty())
+ debug << entry.m_entries.count() << "nonexistent entries";
+ return debug;
+}
+
KDirWatchPrivate::Entry* KDirWatchPrivate::entry(const QString& _path)
{
// we only support absolute paths
@@ -1257,19 +1269,22 @@
c->pending = NoChange;
if (event == NoChange) continue;
+ // Emit the signals delayed, to avoid unexpected re-entrancy from the slots (#220153)
+
if (event & Deleted) {
- c->instance->setDeleted(path);
+ QMetaObject::invokeMethod(c->instance, "setDeleted", Qt::QueuedConnection, Q_ARG(QString, path));
// emit only Deleted event...
continue;
}
if (event & Created) {
- c->instance->setCreated(path);
+ QMetaObject::invokeMethod(c->instance, "setCreated", Qt::QueuedConnection, Q_ARG(QString, path));
// possible emit Change event after creation
}
- if (event & Changed)
- c->instance->setDirty(path);
+ if (event & Changed) {
+ QMetaObject::invokeMethod(c->instance, "setDirty", Qt::QueuedConnection, Q_ARG(QString, path));
+ }
}
}
@@ -1353,11 +1368,8 @@
QList<Entry*> dList, cList;
#endif
- // Make a copy of the list to avoid crashes during reentrancy from slots (#220153)
- EntryMap mapEntries = m_mapEntries;
-
- it = mapEntries.begin();
- for( ; it != mapEntries.end(); ++it ) {
+ it = m_mapEntries.begin();
+ for( ; it != m_mapEntries.end(); ++it ) {
// we don't check invalid entries (i.e. remove delayed)
if (!(*it).isValid()) continue;
--- branches/KDE/4.4/kdelibs/kio/kio/kdirwatch.h #1090728:1090729
@@ -216,22 +216,6 @@
*/
static void statistics();
- /**
- * Emits created().
- * @param path the path of the file or directory
- */
- void setCreated( const QString &path );
- /**
- * Emits dirty().
- * @param path the path of the file or directory
- */
- void setDirty( const QString &path );
- /**
- * Emits deleted().
- * @param path the path of the file or directory
- */
- void setDeleted( const QString &path );
-
enum Method { FAM, INotify, DNotify, Stat };
/**
* Returns the preferred internal method to
@@ -259,6 +243,26 @@
*/
static bool exists();
+public Q_SLOTS:
+
+ /**
+ * Emits created().
+ * @param path the path of the file or directory
+ */
+ void setCreated( const QString &path );
+
+ /**
+ * Emits dirty().
+ * @param path the path of the file or directory
+ */
+ void setDirty( const QString &path );
+
+ /**
+ * Emits deleted().
+ * @param path the path of the file or directory
+ */
+ void setDeleted( const QString &path );
+
Q_SIGNALS:
/**
--- branches/KDE/4.4/kdelibs/kio/kio/kdirwatch_p.h #1090728:1090729
@@ -266,5 +266,7 @@
bool _isStopped;
};
+QDebug operator<<(QDebug debug, const KDirWatchPrivate::Entry &entry);
+
#endif // KDIRWATCH_P_H
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic