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

List:       kde-commits
Subject:    [baloo] src/file: Fix dbus warnings
From:       Vishesh Handa <me () vhanda ! in>
Date:       2015-09-30 16:41:40
Message-ID: E1ZhKRo-0001io-9g () scm ! kde ! org
[Download RAW message or body]

Git commit 3905929f5f8be6dbe23c1e02ebd093e1608245a3 by Vishesh Handa.
Committed on 30/09/2015 at 16:05.
Pushed by vhanda into branch 'master'.

Fix dbus warnings

We cannot emit dbus signals from a different thread than the thread the
object has an affinity to.

REVIEW: 125429

M  +6    -2    src/file/filecontentindexer.cpp

http://commits.kde.org/baloo/3905929f5f8be6dbe23c1e02ebd093e1608245a3

diff --git a/src/file/filecontentindexer.cpp b/src/file/filecontentindexer.cpp
index 4323c3f..8abab52 100644
--- a/src/file/filecontentindexer.cpp
+++ b/src/file/filecontentindexer.cpp
@@ -68,16 +68,20 @@ void FileContentIndexer::run()
 
         process.index(idList);
         loop.exec();
-        Q_EMIT newBatchTime(timer.elapsed());
+
+        QMetaObject::invokeMethod(this, "newBatchTime", Qt::QueuedConnection, \
Q_ARG(uint, timer.elapsed()));  }
-    Q_EMIT done();
+    QMetaObject::invokeMethod(this, "done", Qt::QueuedConnection);
 }
 
 void FileContentIndexer::slotIndexingFile(QString filePath)
 {
     m_currentFile = filePath;
     if (!m_registeredMonitors.isEmpty()) {
+        // We cannot just use Q_EMIT as we are not in the thread the object was \
created in +        // QDbus requires us to be in object creation thread (thread \
affinity)  Q_EMIT indexingFile(filePath);
+        QMetaObject::invokeMethod(this, "indexingFile", Qt::QueuedConnection, \
Q_ARG(QString, filePath));  }
 }
 


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

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