From 2cae1ecc415ca561062f137fb8eb80798ba7d57f Mon Sep 17 00:00:00 2001 From: Birk Skyum <74932975+birkskyum@users.noreply.github.com> Date: Wed, 7 Sep 2022 19:16:55 +0200 Subject: [PATCH] Fix MGLOfflineStorageTests (#428) --- platform/ios/platform/darwin/src/MGLOfflinePack.mm | 5 +++-- platform/ios/platform/ios/test/CI.xctestplan | 3 +-- platform/ios/platform/macos/test/CI.xctestplan | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/platform/ios/platform/darwin/src/MGLOfflinePack.mm b/platform/ios/platform/darwin/src/MGLOfflinePack.mm index e5f742bf3..e6e61d3f5 100644 --- a/platform/ios/platform/darwin/src/MGLOfflinePack.mm +++ b/platform/ios/platform/darwin/src/MGLOfflinePack.mm @@ -144,11 +144,12 @@ private: MGLOfflineStorage *sharedOfflineStorage = [MGLOfflineStorage sharedOfflineStorage]; __weak MGLOfflinePack *weakSelf = self; [sharedOfflineStorage getPacksWithCompletionHandler:^(NSArray *packs, __unused NSError * _Nullable error) { + MGLOfflinePack *strongSelf = weakSelf; for (MGLOfflinePack *pack in packs) { if (pack.mbglOfflineRegion->getID() == regionID) { - weakSelf.mbglOfflineRegion = pack.mbglOfflineRegion; - break; + strongSelf.mbglOfflineRegion = pack.mbglOfflineRegion; } + [pack invalidate]; } completion(error); }]; diff --git a/platform/ios/platform/ios/test/CI.xctestplan b/platform/ios/platform/ios/test/CI.xctestplan index b7e4d3762..bb29095f0 100644 --- a/platform/ios/platform/ios/test/CI.xctestplan +++ b/platform/ios/platform/ios/test/CI.xctestplan @@ -31,8 +31,7 @@ "testTargets" : [ { "skippedTests" : [ - "MGLMapSnapshotterTests\/testLocalGlyphRendering", - "MGLOfflineStorageTests\/testAddPackForBounds" + "MGLMapSnapshotterTests\/testLocalGlyphRendering" ], "target" : { "containerPath" : "container:ios.xcodeproj", diff --git a/platform/ios/platform/macos/test/CI.xctestplan b/platform/ios/platform/macos/test/CI.xctestplan index 78f265433..cfdf87c5d 100644 --- a/platform/ios/platform/macos/test/CI.xctestplan +++ b/platform/ios/platform/macos/test/CI.xctestplan @@ -21,8 +21,7 @@ "testTargets" : [ { "skippedTests" : [ - "MGLMapSnapshotterTests\/testLocalGlyphRendering", - "MGLOfflineStorageTests\/testAddPackForBounds" + "MGLMapSnapshotterTests\/testLocalGlyphRendering" ], "target" : { "containerPath" : "container:macos.xcodeproj",