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 @@ - (id)init - (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 @@ - (void)dealloc 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]; }