QtDBus: Use QMetaObject::invokeMethod instead of QTimer::singleShot
Change-Id: I1a9ecdcb8df7804d13fdcf676fc12b1e0f6bddae Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
90d3c5b951
commit
3ef514f8d3
@ -153,7 +153,8 @@ QDBusConnectionPrivate *QDBusConnectionManager::connectToBus(QDBusConnection::Bu
|
|||||||
if (suspendedDelivery && data.result->connection) {
|
if (suspendedDelivery && data.result->connection) {
|
||||||
data.result->ref.ref();
|
data.result->ref.ref();
|
||||||
QDBusConnectionDispatchEnabler *o = new QDBusConnectionDispatchEnabler(data.result);
|
QDBusConnectionDispatchEnabler *o = new QDBusConnectionDispatchEnabler(data.result);
|
||||||
QTimer::singleShot(0, o, SLOT(execute()));
|
QMetaObject::invokeMethod(o, &QDBusConnectionDispatchEnabler::execute,
|
||||||
|
Qt::QueuedConnection);
|
||||||
o->moveToThread(qApp->thread()); // qApp was checked in the caller
|
o->moveToThread(qApp->thread()); // qApp was checked in the caller
|
||||||
}
|
}
|
||||||
return data.result;
|
return data.result;
|
||||||
|
@ -296,7 +296,7 @@ static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, v
|
|||||||
newConnection->ref.ref();
|
newConnection->ref.ref();
|
||||||
QReadLocker serverLock(&serverConnection->lock);
|
QReadLocker serverLock(&serverConnection->lock);
|
||||||
QDBusConnectionDispatchEnabler *o = new QDBusConnectionDispatchEnabler(newConnection);
|
QDBusConnectionDispatchEnabler *o = new QDBusConnectionDispatchEnabler(newConnection);
|
||||||
QTimer::singleShot(0, o, SLOT(execute()));
|
QMetaObject::invokeMethod(o, &QDBusConnectionDispatchEnabler::execute, Qt::QueuedConnection);
|
||||||
if (serverConnection->serverObject)
|
if (serverConnection->serverObject)
|
||||||
o->moveToThread(serverConnection->serverObject->thread());
|
o->moveToThread(serverConnection->serverObject->thread());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user