MacOs 12.0.1 problems with QtBluetooth
-
Hi everyone,
I'm having problems running my MacOs application on MacOs Monterey 12.0.1. I'm using Qt 5.15.7 clang 64bit and I have updated Xcode to version 13.2.
My application can connect to bluetooth classic devices. When I start a new discovery with the command:
discoveryAgent = new QBluetoothDeviceDiscoveryAgent(); // Start a discovery discoveryAgent->start(QBluetoothDeviceDiscoveryAgent::ClassicMethod);
the application after a few seconds crashes and I don't understand why. With macOS Big Sur I did not see this behaviour. This is the stack trace:
1 None No value 0x4f52 2 -[OSXBTConnectionMonitor connectionNotification:withDevice:] osxbtconnectionmonitor.mm 121 0x1017c8d44 3 __59-[IOBluetoothConcreteUserNotification peerConnected:error:]_block_invoke (x86_64) /System/Library/Frameworks/IOBluetooth.framework/Versions/A/IOBluetooth 0x7ff824d4bbdc 4 _dispatch_call_block_and_release (x86_64) /usr/lib/system/libdispatch.dylib 0x7ff815cb1ad8 5 _dispatch_client_callout (x86_64) /usr/lib/system/libdispatch.dylib 0x7ff815cb2cc9 6 _dispatch_main_queue_callback_4CF (x86_64) /usr/lib/system/libdispatch.dylib 0x7ff815cbf5d8 7 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ (x86_64h) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x7ff815f6e5d9 8 __CFRunLoopRun (x86_64h) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x7ff815f2f6ae 9 CFRunLoopRunSpecific (x86_64h) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x7ff815f2e52d 10 RunCurrentEventLoopInMode (x86_64) /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox 0x7ff81eb4c3e1 11 ReceiveNextEventCommon (x86_64) /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox 0x7ff81eb4c137 12 _BlockUntilNextEventMatchingListInModeWithFilter (x86_64) /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox 0x7ff81eb4bed5 13 _DPSNextEvent (x86_64) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x7ff8189598f0 14 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] (x86_64) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 0x7ff818957f5c 15 qt_mac_waitForMoreEvents(NSString *) qcocoaeventdispatcher.mm 342 0x1042d4356 16 QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) qcocoaeventdispatcher.mm 411 0x1042d431b 17 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) qeventloop.cpp 139 0x103ddadef 18 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) qeventloop.cpp 232 0x103ddadcb 19 QCoreApplication::exec() qcoreapplication.cpp 1375 0x103ddf372 20 main main.cpp 215 0x1005578b5 ... <More>
It looks like a problem with osxbtconnectionmonitor.mm file, in particular when I debug the process it stucks at line 121 of that file. but I cannot understand why.
The first thing I tried was to update everything (Qt and XCode) but it didn't solve my problem.Inside the application output I can see this message before the app crashes:
[CoreBluetooth] No name or address
Searching on the net I have found this thread:
https://stackoverflow.com/questions/69661809/no-name-or-address-cbcentralmanager-no-longer-working-on-macos-12Anybody knows about this problem? Is there something I can do?
Thanks in advance!