From 2e67a5a00752f176faeceaab8530710868a7177b Mon Sep 17 00:00:00 2001 From: avolkov Date: Sun, 26 Feb 2012 20:32:22 +0000 Subject: [PATCH] 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 --- sc2/src/libs/graphics/dcqueue.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sc2/src/libs/graphics/dcqueue.c b/sc2/src/libs/graphics/dcqueue.c index 086cc1a4c..70c066274 100644 --- a/sc2/src/libs/graphics/dcqueue.c +++ b/sc2/src/libs/graphics/dcqueue.c @@ -226,7 +226,7 @@ TFB_DrawCommandQueue_Clear () } static void -checkExclusiveThread (void) +checkExclusiveThread (TFB_DrawCommand* DrawCommand) { #ifdef DEBUG_DCQ_THREADS static uint32 exclusiveThreadId; @@ -234,10 +234,18 @@ checkExclusiveThread (void) // Only one thread is currently allowed to enqueue commands // 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) exclusiveThreadId = SDL_ThreadID(); else assert (SDL_ThreadID() == exclusiveThreadId); +#else + (void) DrawCommand; // suppress unused warning #endif } @@ -249,7 +257,7 @@ TFB_EnqueueDrawCommand (TFB_DrawCommand* DrawCommand) return; } - checkExclusiveThread (); + checkExclusiveThread (DrawCommand); if (DrawCommand->Type <= TFB_DRAWCOMMANDTYPE_COPYTOIMAGE && _CurFramePtr->Type == SCREEN_DRAWABLE)