From 69917353674b378bc89d7f70b2791764bc30d138 Mon Sep 17 00:00:00 2001 From: Juha Vuolle Date: Mon, 19 Aug 2024 14:55:39 +0300 Subject: [PATCH] Darwin: Reset CBCentralManager delegate after processing callbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.7 6.5 Change-Id: I1439881fd55bdfd42bc27ee57f26826fc66c3d85 Reviewed-by: Tor Arne Vestbø (cherry picked from commit b45d26f59368f530330b7d547846b5a74d80d585) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/platform/darwin/qdarwinpermissionplugin_bluetooth.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/platform/darwin/qdarwinpermissionplugin_bluetooth.mm b/src/corelib/platform/darwin/qdarwinpermissionplugin_bluetooth.mm index 0cd375561fb..ccb8a6af0d9 100644 --- a/src/corelib/platform/darwin/qdarwinpermissionplugin_bluetooth.mm +++ b/src/corelib/platform/darwin/qdarwinpermissionplugin_bluetooth.mm @@ -66,6 +66,7 @@ callback(status); m_callbacks = {}; + self.manager.delegate = nil; self.manager = nil; }