fix regression: memory leak in processtasks. also the repeating task fix needs curren...
authorbeware <beware@bircd.org>
Sun, 26 Sep 2021 19:12:21 +0000 (19:12 +0000)
committerbeware <beware@bircd.org>
Sun, 26 Sep 2021 19:12:21 +0000 (19:12 +0000)
git-svn-id: file:///svnroot/lcore/trunk@161 b1de8a11-f9be-4011-bde0-cc7ace90066a

lcore.pas
lcoreselect.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
index a20a55b9a799c9b8f21d308a5e29e5caaa7bffd6..ad816002eced002543ec03de43363c7b4331ca24 100644 (file)
@@ -190,7 +190,7 @@ begin
     prepsigpipe;\r
   {$endif}\r
   selectresult := select(maxs+1,@fdsr,@fdsw,nil,0);\r
-  while (selectresult>0) or assigned(firsttask) or assigned(currenttask) do begin;\r
+  while (selectresult>0) or assigned(firsttask) do begin;\r
 \r
     processtasks;\r
     processtimers;\r