From 68ff978cd62db71cba877f42d87eecac6f83fcd0 Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Wed, 6 May 2015 15:13:51 -0700 Subject: [PATCH] fix lingering backgrounding crashes & add debug mode --- platform/ios/MGLMapView.mm | 63 +++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index 9fd94fc7bf9..c0975051c31 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -78,6 +78,7 @@ @interface MGLMapView () getDebug() && [self.glSnapshotView.subviews count] == 0) + { + UIView *snapshotTint = [[UIView alloc] initWithFrame:self.glSnapshotView.bounds]; + snapshotTint.autoresizingMask = self.glSnapshotView.autoresizingMask; + snapshotTint.backgroundColor = [[UIColor redColor] colorWithAlphaComponent:0.25]; + [self.glSnapshotView addSubview:snapshotTint]; + } - _mbglMap->pause(); + _mbglMap->pause(); - [self.glView deleteDrawable]; + [self.glView deleteDrawable]; + } } -- (void)appWillForeground:(NSNotification *)notification +- (void)wakeGL:(NSNotification *)notification { - self.glSnapshotView.hidden = YES; + MGLAssertIsMainThread(); + + if (self.isDormant) + { + self.dormant = NO; + + self.glSnapshotView.hidden = YES; - [self.glView bindDrawable]; + [self.glSnapshotView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; - _mbglMap->resume(); + [self.glView bindDrawable]; + + _mbglMap->resume(); + } } - (void)tintColorDidChange