Delete framebuffer in dealloc

This seems to work reliably now.
master
Graham 4 years ago
parent 1c224bbd97
commit 6c75a3c590
  1. 18
      gl-natives/src/main/c/jaggl.c

@ -233,6 +233,14 @@ static void *jaggl_proc_addr(const char *name) {
} }
- (void)dealloc { - (void)dealloc {
if (framebuffer && CGLSetCurrentContext(jaggl_onscreen_context) == kCGLNoError) {
glDeleteRenderbuffersEXT(1, &renderbuffer_depth);
glDeleteRenderbuffersEXT(1, &renderbuffer_color);
glDeleteFramebuffersEXT(1, &framebuffer);
CGLSetCurrentContext(NULL);
}
[lock release]; [lock release];
[super dealloc]; [super dealloc];
} }
@ -362,15 +370,7 @@ static void *jaggl_proc_addr(const char *name) {
} }
- (void)releaseCGLContext:(CGLContextObj)context { - (void)releaseCGLContext:(CGLContextObj)context {
/* // empty
* 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 @end
#endif #endif

Loading…
Cancel
Save