Pārlūkot izejas kodu

fixed hanging of MainLoop.add (closes #10308)

Aleksandr Kuzmenko 4 gadi atpakaļ
vecāks
revīzija
d05ba02a19
1 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. 3 3
      std/haxe/MainLoop.hx

+ 3 - 3
std/haxe/MainLoop.hx

@@ -110,11 +110,11 @@ class MainLoop {
 	static function injectIntoEventLoop(waitMs:Int) {
 		#if (target.threaded && !cppia)
 			mutex.acquire();
-			if(eventLoopHandler != null) {
-				mainThread.events.cancel(eventLoopHandler);
-			}
 			eventLoopHandler = mainThread.events.repeat(
 				() -> {
+					if(eventLoopHandler != null) {
+						mainThread.events.cancel(eventLoopHandler);
+					}
 					var wait = tick();
 					if(hasEvents()) {
 						injectIntoEventLoop(Std.int(wait * 1000));