Skip to content

Commit

Permalink
Make sure to set music player's sequence to NULL before disposing mus…
Browse files Browse the repository at this point in the history
…ic sequence

Otherwise a context OS error will occur which will prevent cleaning up memory.
  • Loading branch information
ioan-chera committed Mar 30, 2019
1 parent 9b3ce6d commit 9a02f0a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions native_midi/native_midi_macosx.c
Expand Up @@ -253,6 +253,10 @@ void native_midi_freesong(NativeMidiSong *song)
if (currentsong == song)
currentsong = NULL;
MusicPlayerStop(song->player);

// needed to prevent error and memory leak when disposing sequence
MusicPlayerSetSequence(song->player, NULL);

DisposeMusicSequence(song->sequence);
DisposeMusicPlayer(song->player);
free(song);
Expand Down

0 comments on commit 9a02f0a

Please sign in to comment.