Browse Source

Failure when exiting when "system required" thread was not allocated, caused by 4b389600

(cherry picked from commit 6c9661a20ec1fbb2dcfc234bb02a29f607b2ccb7)

Source commit: f80bd426ef39ae533beefbce3e75cf4ff75dbe2b
Martin Prikryl 3 years ago
parent
commit
3ecd0f1520
1 changed files with 7 additions and 3 deletions
  1. 7 3
      source/windows/GUITools.cpp

+ 7 - 3
source/windows/GUITools.cpp

@@ -2228,7 +2228,11 @@ void GUIFinalize()
     Thread = SystemRequiredThread;
     SystemRequiredThread = NULL;
   }
-  Thread->Terminate();
-  Thread->WaitFor();
-  delete Thread;
+
+  if (Thread != NULL)
+  {
+    Thread->Terminate();
+    Thread->WaitFor();
+    delete Thread;
+  }
 }