From 7cb2d467c3421eced44ae7b887b8738cc68595fc Mon Sep 17 00:00:00 2001 From: Dave Andrews Date: Mon, 22 Aug 2016 22:43:55 -0400 Subject: Fix asynchronous signals from QObjects in different threads Switches the signal listener in QWebChannel from using Qt::DirectConnection to Qt::AutoConnection to relay signals from QObjects in different affinities than the QWebChannel. Also adds a unit test in testAsyncObject() to verify that QWebChannel no longer crashes when receiving such a signal, and that such objects can be added and removed dynamically. Task-number: QTBUG-51366 Change-Id: I51a4886286fec9257a21ea95360c1ea8889a584a Reviewed-by: Dave Andrews Reviewed-by: Milian Wolff --- src/webchannel/signalhandler_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/webchannel/signalhandler_p.h') diff --git a/src/webchannel/signalhandler_p.h b/src/webchannel/signalhandler_p.h index 971c1c9..0f99c5c 100644 --- a/src/webchannel/signalhandler_p.h +++ b/src/webchannel/signalhandler_p.h @@ -178,7 +178,7 @@ void SignalHandler::connectTo(const QObject *object, const int signalI } // otherwise not yet connected, do so now static const int memberOffset = QObject::staticMetaObject.methodCount(); - QMetaObject::Connection connection = QMetaObject::connect(object, signal.methodIndex(), this, memberOffset + signalIndex, Qt::DirectConnection, 0); + QMetaObject::Connection connection = QMetaObject::connect(object, signal.methodIndex(), this, memberOffset + signalIndex, Qt::AutoConnection, 0); if (!connection) { qWarning() << "SignalHandler: QMetaObject::connect returned false. Unable to connect to" << object << signal.name() << signal.methodSignature(); return; -- cgit v1.2.1