diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index ae4d29ca9..c3a24bd07 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -4763,6 +4763,13 @@ void GPUSubsystem::_UpdateFPSRender3D() void GPUSubsystem::SetEventHandler(GPUEventHandler *eventHandler) { + if ( (eventHandler == NULL) && (this->_event != this->_defaultEventHandler) ) + { + this->ForceFrameStop(); + this->_event = this->_defaultEventHandler; + return; + } + this->_event = eventHandler; } diff --git a/desmume/src/frontend/cocoa/cocoa_GPU.mm b/desmume/src/frontend/cocoa/cocoa_GPU.mm index 156a2da11..3b29db7c9 100644 --- a/desmume/src/frontend/cocoa/cocoa_GPU.mm +++ b/desmume/src/frontend/cocoa/cocoa_GPU.mm @@ -193,6 +193,8 @@ - (id)init - (void)dealloc { + GPU->SetEventHandler(NULL); // Unassigned our event handler before we delete it. + delete fetchObject; delete gpuEvent;