1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-24 17:49:52 +01:00

fix for render crash

This commit is contained in:
FunkyFr3sh 2017-11-12 16:10:15 +01:00
parent fbdfe63231
commit 772c0374eb
3 changed files with 8 additions and 8 deletions

BIN
ddraw.dll

Binary file not shown.

9
main.c
View File

@ -544,13 +544,6 @@ ULONG __stdcall ddraw_Release(IDirectDrawImpl *This)
PostMessage(This->hWnd, WM_USER, 0, 0); PostMessage(This->hWnd, WM_USER, 0, 0);
} }
if (This->render.thread)
{
HANDLE thread = This->render.thread;
This->render.thread = NULL;
WaitForSingleObject(thread, INFINITE);
}
if(This->render.hDC) if(This->render.hDC)
{ {
ReleaseDC(This->hWnd, This->render.hDC); ReleaseDC(This->hWnd, This->render.hDC);
@ -738,7 +731,7 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
} }
GetPrivateProfileStringA("ddraw", "screenshotKey", "G", tmp, sizeof(tmp), This->ini_path); GetPrivateProfileStringA("ddraw", "screenshotKey", "G", tmp, sizeof(tmp), This->ini_path);
ddraw->screenshotKey = tmp[0]; ddraw->screenshotKey = toupper(tmp[0]);
This->render.maxfps = GetPrivateProfileIntA("ddraw", "max_fps", 120, This->ini_path); This->render.maxfps = GetPrivateProfileIntA("ddraw", "max_fps", 120, This->ini_path);
This->render.width = GetPrivateProfileIntA("ddraw", "width", 0, This->ini_path); This->render.width = GetPrivateProfileIntA("ddraw", "width", 0, This->ini_path);

View File

@ -44,6 +44,13 @@ ULONG __stdcall ddraw_surface_Release(IDirectDrawSurfaceImpl *This)
if(This->Ref == 0) if(This->Ref == 0)
{ {
if (ddraw->render.thread)
{
HANDLE thread = ddraw->render.thread;
ddraw->render.thread = NULL;
WaitForSingleObject(thread, INFINITE);
}
if(This->caps == DDSCAPS_PRIMARYSURFACE) if(This->caps == DDSCAPS_PRIMARYSURFACE)
{ {
EnterCriticalSection(&ddraw->cs); EnterCriticalSection(&ddraw->cs);