Merge pull request #2540 from unknownbrackets/windows-ui

Fix a couple crashes on shutdown
This commit is contained in:
Henrik Rydgård 2013-06-29 23:32:17 -07:00
commit 752d974284
3 changed files with 11 additions and 4 deletions

View file

@ -316,8 +316,8 @@ void SasInstance::SetGrainSize(int newGrainSize) {
delete [] resampleBuffer;
// 2 samples padding at the start, that's where we copy the two last samples from the channel
// so that we can do bicubic resampling if necessary.
resampleBuffer = new s16[grainSize * 4 + 2];
// so that we can do bicubic resampling if necessary. Plus 1 for smoothness hackery.
resampleBuffer = new s16[grainSize * 4 + 3];
}
static inline s16 clamp_s16(int i) {
@ -509,7 +509,7 @@ void SasInstance::DoState(PointerWrap &p) {
p.DoArray(sendBuffer, grainSize * 2);
}
if (resampleBuffer != NULL && grainSize > 0) {
p.DoArray(resampleBuffer, grainSize * 4 + 2);
p.DoArray(resampleBuffer, grainSize * 4 + 3);
}
int n = PSP_SAS_VOICES_MAX;

View file

@ -17,6 +17,8 @@ static int xres, yres;
// TODO: Make config?
static bool enableGLDebug = false;
#pragma optimize("", off)
void GL_SetVSyncInterval(int interval=1)
{
if( wglSwapIntervalEXT )
@ -219,7 +221,10 @@ void GL_Shutdown() {
}
if (hDC && !ReleaseDC(hWnd,hDC)) {
MessageBox(NULL,"Release Device Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
DWORD err = GetLastError();
if (err != ERROR_DC_NOT_FOUND) {
MessageBox(NULL,"Release Device Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
}
hDC = NULL;
}
hWnd = NULL;

View file

@ -154,6 +154,8 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
VFSShutdown();
EmuThread_Stop();
DialogManager::DestroyAll();
timeEndPeriod(1);
delete host;