Fixed rare crash when loading rom

Caused by _ppuOutputBuffer pointing to freed memory
This commit is contained in:
Sour 2020-02-26 21:42:43 -05:00
parent 9b27cc109e
commit 24d5d5afed

View file

@ -212,9 +212,6 @@ void VideoDecoder::StartThread()
_frameCount = 0;
_waitForFrame.Reset();
//TODO
//_hud.reset(new VideoHud());
_decodeThread.reset(new thread(&VideoDecoder::DecodeThread, this));
}
#endif
@ -230,16 +227,14 @@ void VideoDecoder::StopThread()
_decodeThread.reset();
//TODO
//_hud.reset();
/*UpdateVideoFilter();*/
if(_ppuOutputBuffer != nullptr) {
//Clear whole screen
//Clear whole screen
if(_frameCount > 0) {
vector<uint16_t> outputBuffer(512 * 478, 0);
_ppuOutputBuffer = outputBuffer.data();
memset(_ppuOutputBuffer, 0, 512 * 478 * 2);
DecodeFrame();
_ppuOutputBuffer = nullptr;
}
_ppuOutputBuffer = nullptr;
}
#endif
}