{$endif}\r
\r
procedure processtasks;//inline;\r
-var\r
- temptask : tltask ;\r
-\r
begin\r
\r
- if not assigned(currenttask) then begin\r
+ while assigned(firsttask) do begin\r
currenttask := firsttask;\r
- firsttask := nil;\r
- lasttask := nil;\r
- end;\r
- while assigned(currenttask) do begin\r
+ firsttask := firsttask.nexttask;\r
+ if not assigned(firsttask) then lasttask := nil;\r
\r
if assigned(currenttask.handler) then currenttask.handler(currenttask.wparam,currenttask.lparam);\r
- if assigned(currenttask) then begin\r
- temptask := currenttask;\r
- currenttask := currenttask.nexttask;\r
- temptask.free;\r
- end;\r
- //writeln('processed a task');\r
- end;\r
\r
+ end;\r
+ currenttask := nil;\r
end;\r
\r
\r
procedure disconnecttasks(aobj:tobject);\r
var\r
currenttasklocal : tltask ;\r
- counter : byte ;\r
+\r
begin\r
- for counter := 0 to 1 do begin\r
- if counter = 0 then begin\r
- currenttasklocal := firsttask; //main list of tasks\r
- end else begin\r
- currenttasklocal := currenttask; //needed in case called from a task\r
- end;\r
- // note i don't bother to destroy the links here as that will happen when\r
- // the list of tasks is processed anyway\r
- while assigned(currenttasklocal) do begin\r
- if currenttasklocal.obj = aobj then begin\r
- currenttasklocal.obj := nil;\r
- currenttasklocal.handler := nil;\r
- end;\r
- currenttasklocal := currenttasklocal.nexttask;\r
+ currenttasklocal := firsttask; //main list of tasks\r
+\r
+ // note i don't bother to destroy the links here as that will happen when\r
+ // the list of tasks is processed anyway\r
+ while assigned(currenttasklocal) do begin\r
+ if currenttasklocal.obj = aobj then begin\r
+ currenttasklocal.obj := nil;\r
+ currenttasklocal.handler := nil;\r
end;\r
+ currenttasklocal := currenttasklocal.nexttask;\r
end;\r
end;\r
\r