From 995d77faef657bdbafda9cfc6ac4d2946a9414cb Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 18 Apr 2023 00:17:43 -0400 Subject: [PATCH] Dispatch resubscription callback to the right queue. --- src/darwin/Framework/CHIP/MTRBaseDevice.mm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice.mm b/src/darwin/Framework/CHIP/MTRBaseDevice.mm index 32f0c4ae48c58b..a8e585d6bf33a9 100644 --- a/src/darwin/Framework/CHIP/MTRBaseDevice.mm +++ b/src/darwin/Framework/CHIP/MTRBaseDevice.mm @@ -1384,11 +1384,14 @@ - (void)subscribeToAttributePaths:(NSArray * _Nullabl } }; - auto onResubscriptionScheduledCb = [resubscriptionScheduled](NSError * error, NSNumber * resubscriptionDelay) { - if (resubscriptionScheduled) { - resubscriptionScheduled(error, resubscriptionDelay); - } - }; + auto onResubscriptionScheduledCb + = [queue, resubscriptionScheduled](NSError * error, NSNumber * resubscriptionDelay) { + if (resubscriptionScheduled) { + dispatch_async(queue, ^{ + resubscriptionScheduled(error, resubscriptionDelay); + }); + } + }; MTRReadClientContainer * container = [[MTRReadClientContainer alloc] init]; container.deviceID = self.nodeID;