diff --git a/desmume/src/frontend/cocoa/cocoa_GPU.mm b/desmume/src/frontend/cocoa/cocoa_GPU.mm index c9437cf5a..156a2da11 100644 --- a/desmume/src/frontend/cocoa/cocoa_GPU.mm +++ b/desmume/src/frontend/cocoa/cocoa_GPU.mm @@ -193,8 +193,6 @@ GPU3DInterface *core3DList[GPU_3D_RENDERER_COUNT+1] = { - (void)dealloc { - DestroyOpenGLRenderer(); - delete fetchObject; delete gpuEvent; diff --git a/desmume/src/frontend/cocoa/cocoa_core.mm b/desmume/src/frontend/cocoa/cocoa_core.mm index e4e7f6e43..4903cdb1a 100644 --- a/desmume/src/frontend/cocoa/cocoa_core.mm +++ b/desmume/src/frontend/cocoa/cocoa_core.mm @@ -226,6 +226,10 @@ volatile bool execute = true; delete execControl; NDS_DeInit(); + // We must call DestroyOpenGLRenderer() after NDS_Init() because we need to wait for + // the OpenGL renderer to finish before we destroy its associated context. + DestroyOpenGLRenderer(); + [super dealloc]; }