From 16b8b32cf18046f76eb88851dc921297bf609f8b Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 14 Oct 2018 20:00:57 +0200 Subject: [PATCH] Clean up dx_reinit --- Source/dx.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Source/dx.cpp b/Source/dx.cpp index 791003642..f9ecfb2f6 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -286,18 +286,23 @@ void __cdecl dx_cleanup() void __cdecl dx_reinit() { - int v0; // esi - EnterCriticalSection(&sgMemCrit); ClearCursor(); - v0 = sgdwLockCount; + int lockCount = sgdwLockCount; + while ( sgdwLockCount ) unlock_buf_priv(); + dx_cleanup(); + drawpanflag = 255; + dx_init(ghMainWnd); - for ( ; v0; --v0 ) + + while (lockCount) { lock_buf_priv(); + lockCount--; + } + LeaveCriticalSection(&sgMemCrit); } -// 52571C: using guessed type int drawpanflag;