diff options
-rw-r--r-- | platform/darwin/src/MGLFoundation.mm | 4 | ||||
-rw-r--r-- | platform/darwin/src/MGLFoundation_Private.h | 2 | ||||
-rw-r--r-- | platform/darwin/src/MGLOfflineStorage.mm | 3 |
3 files changed, 7 insertions, 2 deletions
diff --git a/platform/darwin/src/MGLFoundation.mm b/platform/darwin/src/MGLFoundation.mm index 1cc56de298..5cda1dced3 100644 --- a/platform/darwin/src/MGLFoundation.mm +++ b/platform/darwin/src/MGLFoundation.mm @@ -1,4 +1,6 @@ #import "MGLFoundation_Private.h" /// Initializes the run loop shim that lives on the main thread. -mbgl::util::RunLoop mgl_runLoop; +void MGLInitializeRunLoop() { + static mbgl::util::RunLoop runLoop; +} diff --git a/platform/darwin/src/MGLFoundation_Private.h b/platform/darwin/src/MGLFoundation_Private.h index 940bb1df69..f231628756 100644 --- a/platform/darwin/src/MGLFoundation_Private.h +++ b/platform/darwin/src/MGLFoundation_Private.h @@ -2,4 +2,4 @@ #include <mbgl/util/run_loop.hpp> -extern mbgl::util::RunLoop mgl_runLoop; +void MGLInitializeRunLoop(); diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm index 9cb472ce5d..b65932c6e8 100644 --- a/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/darwin/src/MGLOfflineStorage.mm @@ -1,5 +1,6 @@ #import "MGLOfflineStorage_Private.h" +#import "MGLFoundation_Private.h" #import "MGLAccountManager_Private.h" #import "MGLGeometry_Private.h" #import "MGLNetworkConfiguration.h" @@ -170,6 +171,8 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK } - (instancetype)init { + MGLInitializeRunLoop(); + if (self = [super init]) { NSURL *cacheURL = [[self class] cacheURLIncludingSubdirectory:YES]; NSString *cachePath = cacheURL.path ?: @""; |