Details
-
Bug
-
Resolution: Invalid
-
P1: Critical
-
None
-
5.6.2, 5.7.1, 5.9.1
-
None
-
Reproduced on Mac OS 10.7 and 10.10 and 10.11
QtCreator 3.4 and 3.6 on Xcode SDK 4.x and 7.x
Reproduced with Qt 5.6.2, 5.7.1 and 5.9.1
Doesn't occur on Linux
Description
See attached BugDemo.cpp.
If connectToService is run in the main thread and QBluetoothSocket is associated with the main thread everything works as specified.
If QBluetoothSocket is moved to a separate thread with its own event loop a connect never happens; none of the signals is ever emitted.
This issue only appears on OS X (all tested versions); on Linux everything works fine regardless of the thread affinity of QBluetooth socket.
A similar effect can be achieved when running IOBluetoothRFCOMMChannel or its delegate without an event loop. I therefore conclude that for some reasons the QThread based event loop is not sufficient to run IOBluetoothRFCOMMChannel (which is somewhere burried deep inside the QBluetoothSocket machinery).