From 4bce1481c5cfbd402973c2a488b36499ed44af2e Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 11 Oct 2017 10:10:27 +0200 Subject: IOBluetooth: warn about incorrent thread/runloop IOBluetooth is heavily based on CFRunLoops. An attempt to use it on a thread, that does not properly run CFRunLoop results in callbacks never firing and thus QBluetooth classes never finishing their jobs, including: - device discovery - service discovery - RFCOMM/LCAP2 - Bluetooth server - Bluetooth socket etc. While we cannot fix the core problem until we have a properly working CoreFoundation event dispatcher, we can at least issue a warning so that people do not waste their time debugging this well-known limitation. Task-number: QTBUG-63630 Change-Id: Iefa4d675ea0962167bdfede640d2087dbdf37b18 Reviewed-by: Alex Blasche --- src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm') diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm b/src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm index 9e3f6a57..7f037596 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_osx.mm @@ -245,6 +245,8 @@ void QBluetoothDeviceDiscoveryAgentPrivate::startClassic() Q_ASSERT(requestedMethods & QBluetoothDeviceDiscoveryAgent::ClassicMethod); Q_ASSERT(agentState == NonActive); + OSXBluetooth::qt_test_iobluetooth_runloop(); + if (!inquiry) { // The first Classic scan for this DDA. inquiry.reset([[DeviceInquiryObjC alloc]initWithDelegate:this]); -- cgit v1.2.3