Darwin: Reset CBCentralManager delegate after processing callbacks

We maintain the CBCentralManager in a retained property, which we
nil when we're done processing the callbacks. But the manager may
still be kept alive by other parts of the system, resulting in
callbacks to our delegate, where we would assert on the check
that the delegate callback manager matched our stored manager.

The conditions for the assert to occur:
- debug build (Q_ASSERT)
- permissions are actually requested
- bluetooth is toggled ON or OFF

This patch fixes this so that the listening delegate is
nil'd and therefore no additional callbacks are received.

Pick-to: 6.8 6.7 6.5
Change-Id: I1439881fd55bdfd42bc27ee57f26826fc66c3d85
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Juha Vuolle 2024-08-19 14:55:39 +03:00 committed by Tor Arne Vestbø
parent 42004d245e
commit b45d26f593

View File

@ -66,6 +66,7 @@
callback(status);
m_callbacks = {};
self.manager.delegate = nil;
self.manager = nil;
}