Skip to content

Commit

Permalink
Fixed potential shutdown crash bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ferris committed Jun 14, 2013
1 parent c7356e2 commit 54e1024
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Chip8/Apu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ Apu::~Apu()

void Apu::SetAudioDriver(IAudioDriver *audioDriver)
{
mutex->Lock();
auto oldAudioDriver = this->audioDriver;
if (oldAudioDriver) oldAudioDriver->SetRenderCallback(nullptr, nullptr);
this->audioDriver = audioDriver;
audioDriver->SetRenderCallback(renderCallbackRouter, this);
mutex->Unlock();
}

void Apu::SetBeeping(bool beeping)
Expand Down

0 comments on commit 54e1024

Please sign in to comment.