From 5e18198ae45f9f213d04e8cd698b0b4e1204875a Mon Sep 17 00:00:00 2001 From: Graham Date: Mon, 2 Sep 2019 18:58:05 +0100 Subject: [PATCH] Make releaseCGLContext a no-op It is sometimes called after the context is destroyed. Attempting to call any gl* functions in this case causes a segfault. --- gl-natives/src/main/c/jaggl.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gl-natives/src/main/c/jaggl.c b/gl-natives/src/main/c/jaggl.c index 10a34fcf..9a7cbfea 100644 --- a/gl-natives/src/main/c/jaggl.c +++ b/gl-natives/src/main/c/jaggl.c @@ -327,11 +327,15 @@ static void *jaggl_proc_addr(const char *name) { } - (void)releaseCGLContext:(CGLContextObj)context { - CGLSetCurrentContext(context); - [lock lock]; - [self deleteFramebuffer]; - [lock unlock]; - CGLClearDrawable(context); + /* + * Ideally we'd delete the framebuffer/renderbuffers here, if they exist. + * However, releaseCGLContext sometimes ends up being called after we + * destroy the jaggl_onscreen_context, so attempting to call any gl* + * functions here causes a segfault. + * + * Hopefully deleting the context will free up the + * framebuffer/renderbuffers implicitly. + */ } @end #endif