diff --git a/sc2/src/uqm/uqmdebug.c b/sc2/src/uqm/uqmdebug.c index 532539ffc..2f0b1c33a 100644 --- a/sc2/src/uqm/uqmdebug.c +++ b/sc2/src/uqm/uqmdebug.c @@ -1920,11 +1920,14 @@ debugContexts (void) return; inDebugContexts = true; + LockMutex (GraphicsLock); contextCount = countVisibleContexts (); if (contextCount == 0) + { + UnlockMutex (GraphicsLock); goto out; + } - LockMutex (GraphicsLock); savedScreen = getScreen (); //UnlockMutex (GraphicsLock); FlushGraphics (); @@ -1974,7 +1977,9 @@ debugContexts (void) DoInput(&state, TRUE); } + LockMutex (GraphicsLock); SetContext (orgContext); + UnlockMutex (GraphicsLock); // Destroy the debugging frame and context. DestroyContext (debugDrawContext);