fix regression: memory leak in processtasks. also the repeating task fix needs curren...
[lcore.git] / lcore.pas
index f47bdabff64d482bb8ff4aa62001ad6034938b39..08c242a8e2a4b8bcb41d3558ca5eb4627a56e2c9 100644 (file)
--- a/lcore.pas
+++ b/lcore.pas
@@ -225,7 +225,7 @@ procedure exitmessageloop;
 \r
 var\r
   firsttimer                            : tltimer    ;\r
-  firsttask  , lasttask   , currenttask : tltask     ;\r
+  firsttask  , lasttask                 : tltask     ;\r
 \r
   numread                               : integer    ;\r
   mustrefreshfds                        : boolean    ;\r
@@ -812,6 +812,8 @@ end;
 {$endif}\r
 \r
 procedure processtasks;//inline;\r
+var\r
+  currenttask:tltask;\r
 begin\r
 \r
   while assigned(firsttask) do begin\r
@@ -820,7 +822,7 @@ begin
     if not assigned(firsttask) then lasttask := nil;\r
 \r
     if assigned(currenttask.handler) then currenttask.handler(currenttask.wparam,currenttask.lparam);\r
-\r
+    currenttask.free;\r
   end;\r
   currenttask := nil;\r
 end;\r