diff options
Diffstat (limited to 'platform/darwin/src/MGLMapSnapshotter.mm')
-rw-r--r-- | platform/darwin/src/MGLMapSnapshotter.mm | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm index 11a5442761..923c8fb2a1 100644 --- a/platform/darwin/src/MGLMapSnapshotter.mm +++ b/platform/darwin/src/MGLMapSnapshotter.mm @@ -89,7 +89,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; std::shared_ptr<mbgl::ThreadPool> _mbglThreadPool; std::unique_ptr<mbgl::MapSnapshotter> _mbglMapSnapshotter; std::unique_ptr<mbgl::Actor<mbgl::MapSnapshotter::Callback>> _snapshotCallback; - NS_ARRAY_OF(MGLAttributionInfo *) *_attributionInfo; + NSArray<MGLAttributionInfo *> *_attributionInfo; } @@ -122,8 +122,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; _snapshotCallback = std::make_unique<mbgl::Actor<mbgl::MapSnapshotter::Callback>>(*mbgl::Scheduler::GetCurrent(), [=](std::exception_ptr mbglError, mbgl::PremultipliedImage image, mbgl::MapSnapshotter::Attributions attributions, mbgl::MapSnapshotter::PointForFn pointForFn) { __typeof__(self) strongSelf = weakSelf; strongSelf.loading = false; - - + if (mbglError) { NSString *description = @(mbgl::util::toString(mbglError).c_str()); NSDictionary *userInfo = @{NSLocalizedDescriptionKey: description}; @@ -145,9 +144,13 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; } _snapshotCallback = NULL; }); - dispatch_async(queue, ^{ - _mbglMapSnapshotter->snapshot(_snapshotCallback->self()); + dispatch_async(queue, ^{ + __typeof__(self) strongSelf = weakSelf; + if (!strongSelf) { + return; + } + strongSelf->_mbglMapSnapshotter->snapshot(strongSelf->_snapshotCallback->self()); }); } |