Bugfix: TFB_DRAWCOMMANDTYPE_REINITVIDEO is allowed to be queued from the main() thread

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3777 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2012-02-26 20:32:22 +00:00
parent f765eac3ee
commit 2e67a5a007
+10 -2
View File
@@ -226,7 +226,7 @@ TFB_DrawCommandQueue_Clear ()
} }
static void static void
checkExclusiveThread (void) checkExclusiveThread (TFB_DrawCommand* DrawCommand)
{ {
#ifdef DEBUG_DCQ_THREADS #ifdef DEBUG_DCQ_THREADS
static uint32 exclusiveThreadId; static uint32 exclusiveThreadId;
@@ -234,10 +234,18 @@ checkExclusiveThread (void)
// Only one thread is currently allowed to enqueue commands // Only one thread is currently allowed to enqueue commands
// This is not a technical limitation but rather a semantical one atm. // This is not a technical limitation but rather a semantical one atm.
if (DrawCommand->Type == TFB_DRAWCOMMANDTYPE_REINITVIDEO)
{ // TFB_DRAWCOMMANDTYPE_REINITVIDEO is an exception
// It is queued from the main() thread, which is safe to do
return;
}
if (!exclusiveThreadId) if (!exclusiveThreadId)
exclusiveThreadId = SDL_ThreadID(); exclusiveThreadId = SDL_ThreadID();
else else
assert (SDL_ThreadID() == exclusiveThreadId); assert (SDL_ThreadID() == exclusiveThreadId);
#else
(void) DrawCommand; // suppress unused warning
#endif #endif
} }
@@ -249,7 +257,7 @@ TFB_EnqueueDrawCommand (TFB_DrawCommand* DrawCommand)
return; return;
} }
checkExclusiveThread (); checkExclusiveThread (DrawCommand);
if (DrawCommand->Type <= TFB_DRAWCOMMANDTYPE_COPYTOIMAGE if (DrawCommand->Type <= TFB_DRAWCOMMANDTYPE_COPYTOIMAGE
&& _CurFramePtr->Type == SCREEN_DRAWABLE) && _CurFramePtr->Type == SCREEN_DRAWABLE)