From: beware Date: Sun, 26 Sep 2021 19:12:21 +0000 (+0000) Subject: fix regression: memory leak in processtasks. also the repeating task fix needs curren... X-Git-Url: http://www.lcore.org/git/lcore.git/commitdiff_plain/7b89bae75911ccee6bfd92262960f325f1995072 fix regression: memory leak in processtasks. also the repeating task fix needs currenttask to be a local var because of re-entrance git-svn-id: file:///svnroot/lcore/trunk@161 b1de8a11-f9be-4011-bde0-cc7ace90066a --- diff --git a/lcore.pas b/lcore.pas index f47bdab..08c242a 100644 --- a/lcore.pas +++ b/lcore.pas @@ -225,7 +225,7 @@ procedure exitmessageloop; var firsttimer : tltimer ; - firsttask , lasttask , currenttask : tltask ; + firsttask , lasttask : tltask ; numread : integer ; mustrefreshfds : boolean ; @@ -812,6 +812,8 @@ end; {$endif} procedure processtasks;//inline; +var + currenttask:tltask; begin while assigned(firsttask) do begin @@ -820,7 +822,7 @@ begin if not assigned(firsttask) then lasttask := nil; if assigned(currenttask.handler) then currenttask.handler(currenttask.wparam,currenttask.lparam); - + currenttask.free; end; currenttask := nil; end; diff --git a/lcoreselect.pas b/lcoreselect.pas index a20a55b..ad81600 100644 --- a/lcoreselect.pas +++ b/lcoreselect.pas @@ -190,7 +190,7 @@ begin prepsigpipe; {$endif} selectresult := select(maxs+1,@fdsr,@fdsw,nil,0); - while (selectresult>0) or assigned(firsttask) or assigned(currenttask) do begin; + while (selectresult>0) or assigned(firsttask) do begin; processtasks; processtimers;