Skip to content

Commit

Permalink
Cocoa Port: Fix yet another crash-on-exit bug that could happen when …
Browse files Browse the repository at this point in the history
…running on an older system.
  • Loading branch information
rogerman committed Jul 12, 2024
1 parent dd88556 commit d480f95
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions desmume/src/GPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions desmume/src/frontend/cocoa/cocoa_GPU.mm
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ - (id)init

- (void)dealloc
{
GPU->SetEventHandler(NULL); // Unassigned our event handler before we delete it.

delete fetchObject;
delete gpuEvent;

Expand Down

0 comments on commit d480f95

Please sign in to comment.