Skip to content

Commit fae7468

Browse files
committed
apple: fix crash in gl context reinit
1 parent d754ae3 commit fae7468

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

gfx/drivers_context/cocoa_gl_ctx.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ void cocoa_gl_gfx_ctx_update(void)
139139
#if defined(HAVE_COCOATOUCH)
140140
void *glkitview_init(void)
141141
{
142+
/* Delete the old view's framebuffer while we may still have a valid
143+
* GL context. Without this, the subsequent release of the old GLKView
144+
* triggers _deleteFramebuffer during dealloc, which calls
145+
* glPushGroupMarkerEXT with no current context and crashes. */
146+
if (glk_view)
147+
[glk_view deleteDrawable];
148+
142149
glk_view = [GLKView new];
143150
#if TARGET_OS_IOS
144151
glk_view.multipleTouchEnabled = YES;

0 commit comments

Comments
 (0)