X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/ac385c745f6e299bea549eb2006b803e3885c916..2ba734680253339d8b27208a1dfec5e2f220f3d8:/lcore.pas

diff --git a/lcore.pas b/lcore.pas
index 109f4d7..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    ;
@@ -669,7 +669,7 @@ end;
 {$ifndef mswindows}
   procedure tltimer.resettimes;
   begin
-    gettimeofday(nextts);
+    gettimemonotonic(nextts);
     {if not initialevent then} tv_add(nextts,interval);
   end;
 {$endif}
@@ -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;