From d38468439b7116ab9543a458dd2901d9692f50c3 Mon Sep 17 00:00:00 2001 From: shenlong <139912620+shenlong-tanwen@users.noreply.github.com> Date: Mon, 15 Sep 2025 00:47:12 +0530 Subject: [PATCH] fix: complete does not destroy engine on close (#21943) * fix: complete does not destroy engine on close * reset flutterApi on cleanup --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> --- mobile/ios/Runner/Background/BackgroundWorker.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/ios/Runner/Background/BackgroundWorker.swift b/mobile/ios/Runner/Background/BackgroundWorker.swift index 9a965bd360..c3268b4a2b 100644 --- a/mobile/ios/Runner/Background/BackgroundWorker.swift +++ b/mobile/ios/Runner/Background/BackgroundWorker.swift @@ -133,7 +133,6 @@ class BackgroundWorker: BackgroundWorkerBgHostApi { return } - isComplete = true flutterApi?.cancel { result in self.complete(success: false) } @@ -174,6 +173,7 @@ class BackgroundWorker: BackgroundWorkerBgHostApi { isComplete = true engine.destroyContext() + flutterApi = nil completionHandler(success) } }