mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-25 23:40:06 +02:00
Cody: Fix Load-After-Time.
This commit is contained in:
parent
8b2502ef22
commit
0985b55ae5
@ -624,14 +624,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
if ChangeStamp<>OldChangeStamp then begin
|
||||
if fLoaded and (ChangeStamp<>OldChangeStamp) then begin
|
||||
if (fTimer=nil) and (not fClosing) then begin
|
||||
fTimer:=TTimer.Create(nil);
|
||||
fTimer.Interval:=SaveIntervalInS*1000;
|
||||
fTimer.OnTimer:=@OnTimer;
|
||||
end;
|
||||
if fTimer<>nil then
|
||||
if fTimer<>nil then begin
|
||||
fTimer.Interval:=SaveIntervalInS*1000;
|
||||
fTimer.Enabled:=true;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
@ -640,17 +641,28 @@ begin
|
||||
end;
|
||||
end else if fCheckFiles<>nil then begin
|
||||
CheckFiles;
|
||||
end else begin
|
||||
// nothing to do, maybe it's time to load the database
|
||||
if fStartTime=0 then
|
||||
fStartTime:=Now
|
||||
else if (fLoadSaveThread=nil) and (not fLoaded)
|
||||
and (Abs(Now-fStartTime)*86400>=LoadAfterStartInS) then
|
||||
StartLoadSaveThread;
|
||||
end;
|
||||
Done:=fQueuedTools.Count=0;
|
||||
if Done then
|
||||
Done:= fQueuedTools.Count=0;
|
||||
if Done then begin
|
||||
IdleConnected:=false;
|
||||
|
||||
if (not fLoaded) and (fLoadSaveThread=nil) then begin
|
||||
// nothing to do, maybe it's time to load the database
|
||||
if (Abs(Now-fStartTime)*86400>=LoadAfterStartInS) then begin
|
||||
StartLoadSaveThread;
|
||||
end
|
||||
else begin
|
||||
if (fTimer=nil) then begin
|
||||
fTimer:=TTimer.Create(nil);
|
||||
fTimer.OnTimer:=@OnTimer;
|
||||
end;
|
||||
if fTimer<>nil then begin
|
||||
fTimer.Interval:=Max(10, LoadAfterStartInS*1000 - Trunc(Now-fStartTime)*86400);
|
||||
fTimer.Enabled:=true;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCodyUnitDictionary.WaitForThread;
|
||||
@ -787,6 +799,7 @@ begin
|
||||
CodeToolBoss.AddHandlerToolTreeChanging(@ToolTreeChanged);
|
||||
LazarusIDE.AddHandlerOnIDEClose(@OnIDEClose);
|
||||
CodyOptions.AddHandlerApply(@OnApplyOptions);
|
||||
fStartTime:=Now;
|
||||
end;
|
||||
|
||||
destructor TCodyUnitDictionary.Destroy;
|
||||
|
Loading…
Reference in New Issue
Block a user