Closed MSch closed 11 years ago
Ok that's strange. Will take a look at that.
Thanks! I tried looking into it but I know zero OpenGL. All I figured out was that it seems it's enough to have show the GLKView to trigger the crash. :/
Your example was of great help. Thanks for that.
So this issue is an iOS 6 MKMapView issue. It also renders its view in OpenGL and seems to hold a reference to the current EAGLContext of this class (which we can assume is a bug...).
So nullifying the EAGLContext of GLKView seems to do the trick. Replace the -teardownGL
method with this code:
- (void)tearDownGL
{
[EAGLContext setCurrentContext:self->_context];
glDeleteBuffers(1, &self->_vertexBuffer);
glDeleteVertexArraysOES(1, &self->_vertexArray);
GLKView *view = (GLKView *)self.view;
view.context = nil;
[EAGLContext setCurrentContext:nil];
self->_context = nil;
self->_effect = nil;
self->_snapshotSource = nil;
}
Please let me know if it worked.
Yep that worked! Thanks a million!
So I'm guessing this means view.context = nil
stops the GLKView
from tearing down its EAGLContext
so that MapKit can continue to use it?
I think that MKMapView
used a GLKView
with a reference to the EAGLContext
of this class, while it actually should have used its own EAGLContext
(a class can't share a EAGLContext
unless it is explicit set to be shared).
I'm still not sure whether it's a bug inside MKMapView
or this is always happens with multiple instances of GLKView
.
If the
destinationViewController
has aMKMapView
on it the App crashes both on the simulator and device.Here's an example, just press run it and press the button: https://github.com/MSch/GC3DFlipBug