Assert that snapshot view obscures GL view when it exists
Just in case the host app mucks around with `MGLView`’s internal view hierarchy.
This commit is contained in:
@@ -562,7 +562,16 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
|
||||
// This is the delegate of the GLKView object's display call.
|
||||
- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect
|
||||
{
|
||||
if (!self.glSnapshotView)
|
||||
if (self.glSnapshotView)
|
||||
{
|
||||
NSUInteger snapshotIdx = [self.subviews indexOfObject:self.glSnapshotView];
|
||||
NSUInteger glIdx = [self.subviews indexOfObject:self.glView];
|
||||
NSAssert(snapshotIdx > glIdx,
|
||||
@"The snapshot view is the %luth subview, behind the GL view, which is the %luth. "
|
||||
@"The snapshot view should obscure the GL view to prevent crashing while the app is in the background.",
|
||||
(unsigned long)snapshotIdx, (unsigned long)glIdx);
|
||||
}
|
||||
else
|
||||
{
|
||||
mbglView->resize(rect.size.width, rect.size.height, view.contentScaleFactor, view.drawableWidth, view.drawableHeight);
|
||||
mbglMap->renderSync();
|
||||
|
||||
Reference in New Issue
Block a user