diff options
author | Julian Rex <julian.rex@mapbox.com> | 2018-05-02 11:55:58 -0400 |
---|---|---|
committer | Chris Loer <chris.loer@mapbox.com> | 2018-06-04 11:32:20 -0700 |
commit | df4d8bab310d7c5e96e237ff6511178e11b36830 (patch) | |
tree | 4efec9add462133c12638adff2c63d69c68d8cdc | |
parent | af4efd4fa7106a919f730127bdb8bade81fd8203 (diff) | |
download | qtlocation-mapboxgl-df4d8bab310d7c5e96e237ff6511178e11b36830.tar.gz |
[ios, macos] Raise exception if MGLMapSnapshotter is used from thread without active run loop.
-rw-r--r-- | platform/darwin/src/MGLMapSnapshotter.mm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm index 73db8ea151..a63fbfb0a2 100644 --- a/platform/darwin/src/MGLMapSnapshotter.mm +++ b/platform/darwin/src/MGLMapSnapshotter.mm @@ -108,6 +108,11 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; - (void)startWithQueue:(dispatch_queue_t)queue completionHandler:(MGLMapSnapshotCompletionHandler)completion { + if (!mbgl::Scheduler::GetCurrent()) { + [NSException raise:NSInvalidArgumentException + format:@"startWithQueue:completionHandler: must be called from a thread with an active run loop."]; + } + if ([self isLoading]) { [NSException raise:NSInternalInconsistencyException format:@"Already started this snapshotter."]; |