# HG changeset patch # User unc0rr # Date 1450302680 -10800 # Node ID 30397f91571c8c7b71bd26a23c47b2752f858a1a # Parent 8318e841648f9ba70fc0b70108cc3cd897a7310a Fix a ton of bugs in engine instances queue and ipc diff -r 8318e841648f -r 30397f91571c hedgewars/uFLIPC.pas --- a/hedgewars/uFLIPC.pas Wed Dec 16 00:20:56 2015 +0300 +++ b/hedgewars/uFLIPC.pas Thu Dec 17 00:51:20 2015 +0300 @@ -41,7 +41,7 @@ s.next:= nil; s.barrier:= 0; - if (queue^.msg.next = nil) and (queue^.msg.str[0] = #0) and (queue^.msg.buf = nil) then + if (queue^.msg.next = nil) and (queue^.msg.str[0] = #0) and (queue^.msg.buf = nil) and (queue^.msg.barrier = 0) then begin queue^.msg:= s; end else @@ -129,15 +129,19 @@ SDL_LockMutex(q^.mut); pmsg:= @q^.msg; - q^.last:= @q^.msg; - +write(' ipcRemoveBarrierFromEngineQueue: '); while pmsg <> nil do begin + write('.'); t:= pmsg^.next; q^.msg.next:= t; + pmsg^.str[0]:= #0; if pmsg^.buf <> nil then + begin FreeMem(pmsg^.buf, pmsg^.len); + pmsg^.buf:= nil + end; if pmsg <> @q^.msg then if pmsg^.barrier = 0 then @@ -162,6 +166,8 @@ pmsg:= t end; +writeln; + if q^.msg.next = nil then q^.last:= @q^.msg; q^.msg.str[0]:= #0; q^.msg.buf:= nil; diff -r 8318e841648f -r 30397f91571c hedgewars/uFLRunQueue.pas --- a/hedgewars/uFLRunQueue.pas Wed Dec 16 00:20:56 2015 +0300 +++ b/hedgewars/uFLRunQueue.pas Thu Dec 17 00:51:20 2015 +0300 @@ -14,13 +14,12 @@ begin if runQueue <> nil then begin + writeln('RUNNING ', runQueue^.gameType); if runQueue^.gameType = gtPreview then sendUI(mtRenderingPreview, nil, 0); ipcRemoveBarrierFromEngineQueue(); RunEngine(runQueue^.argumentsNumber, @runQueue^.argv); - - sendConfig(runQueue) end end; @@ -36,8 +35,7 @@ var pConfig, t, tt: PGameConfig; i: Longword; begin - ipcSetEngineBarrier(); - + writeln('QUEUE EXECUTION ', config.gameType); new(pConfig); pConfig^:= config; @@ -59,13 +57,15 @@ begin runQueue:= pConfig; + ipcSetEngineBarrier(); + sendConfig(pConfig); nextRun end else begin t:= runQueue; while t^.nextConfig <> nil do begin - if (pConfig^.gameType = gtPreview) and (t^.nextConfig^.gameType = gtPreview) then + if false and (pConfig^.gameType = gtPreview) and (t^.nextConfig^.gameType = gtPreview) and (t <> runQueue) then begin tt:= t^.nextConfig; pConfig^.nextConfig:= tt^.nextConfig; @@ -75,6 +75,9 @@ end; t:= t^.nextConfig; end; + + ipcSetEngineBarrier(); + sendConfig(pConfig); t^.nextConfig:= pConfig end; end;