From 0da4663c8d3a0ffe0f2e4d2d17e7353aa74b2d2e Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 27 May 2010 15:29:53 +0000 Subject: [PATCH] Change ASyncQueue to run in forward order (first in / first out) git-svn-id: trunk@25698 - --- lcl/include/application.inc | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lcl/include/application.inc b/lcl/include/application.inc index fbc4758f27..40daeb1e44 100644 --- a/lcl/include/application.inc +++ b/lcl/include/application.inc @@ -997,10 +997,13 @@ begin begin if Cur.Last<>nil then begin + assert(Cur.Top <> nil, 'TApplication.ProcessAsyncCallQueue: Last entry found, while Top not assigned'); Cur.Last^.NextItem:=Next.Top; Next.Top^.PrevItem:=Cur.Last; - end else + end else begin + assert(Cur.Top = nil, 'TApplication.ProcessAsyncCallQueue: Last entry found, while Top not assigned'); Cur.Top:=Next.Top; + end; Cur.Last:=Next.Last; Next.Top:=nil; Next.Last:=nil; @@ -1010,14 +1013,14 @@ begin // this can create new items, which are added to the next queue // or it can call ProcessAsyncCallQueue, for example via calling // Application.ProcesssMessages - while Cur.Last <> nil do + while Cur.Top <> nil do begin - lItem:=Cur.Last; - Cur.Last:=lItem^.PrevItem; - if Cur.Last=nil then - Cur.Top:=nil + lItem:=Cur.Top; + Cur.Top := lItem^.NextItem; + if Cur.Top = nil then + Cur.Last := nil else - Cur.Last^.NextItem:=nil; + Cur.Top^.PrevItem := nil; Event:=lItem^.Method; Data:=lItem^.Data; Dispose(lItem); @@ -2123,10 +2126,13 @@ begin lItem^.NextItem := nil; with FAsyncCall.Next do begin lItem^.PrevItem := Last; - if Last<>nil then + if Last<>nil then begin + assert(Top <> nil, 'TApplication.QueueAsyncCall: Top entry missing (but last is assigned)'); Last^.NextItem := lItem - else + end else begin + assert(Last = nil, 'TApplication.QueueAsyncCall: Last entry found, while Top not assigned'); Top := lItem; + end; Last := lItem; end; end;