You've already forked lazarus-ccr
Fixed Suspend bug (OnDone is called endless)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@324 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -157,7 +157,7 @@ type
|
|||||||
procedure CallOnProgress;
|
procedure CallOnProgress;
|
||||||
public
|
public
|
||||||
Parent : TObject;
|
Parent : TObject;
|
||||||
bSuspend, Terminating : Boolean;
|
Terminating : Boolean;
|
||||||
Stop : Boolean;
|
Stop : Boolean;
|
||||||
HandleException : TACSHandleThreadException;
|
HandleException : TACSHandleThreadException;
|
||||||
Delay : Integer;
|
Delay : Integer;
|
||||||
@@ -655,10 +655,9 @@ implementation
|
|||||||
ParentComponent : TACSCustomOutput;
|
ParentComponent : TACSCustomOutput;
|
||||||
Res : Boolean;
|
Res : Boolean;
|
||||||
begin
|
begin
|
||||||
bSuspend := false;
|
|
||||||
ParentComponent := TACSCustomOutput(Parent);
|
ParentComponent := TACSCustomOutput(Parent);
|
||||||
while not Terminating do
|
while not Terminating do
|
||||||
if not bSuspend then
|
// if not bSuspend then
|
||||||
begin
|
begin
|
||||||
EnterCriticalSection(CS);
|
EnterCriticalSection(CS);
|
||||||
if Delay > 5 then sleep(Delay);
|
if Delay > 5 then sleep(Delay);
|
||||||
@@ -683,7 +682,7 @@ implementation
|
|||||||
DoneThread.Resume;
|
DoneThread.Resume;
|
||||||
//Dont Suspend the thread maybe Stop has been set to false during OnDone
|
//Dont Suspend the thread maybe Stop has been set to false during OnDone
|
||||||
//check this first
|
//check this first
|
||||||
if (Stop or (not Res)) and bSuspend then
|
if (Stop or (not Res)) then
|
||||||
Self.Suspend;
|
Self.Suspend;
|
||||||
end;
|
end;
|
||||||
except
|
except
|
||||||
@@ -691,7 +690,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
Stop := False;
|
Stop := False;
|
||||||
HandleException(E);
|
HandleException(E);
|
||||||
if bSuspend then
|
// if bSuspend then
|
||||||
Self.Suspend;
|
Self.Suspend;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -822,12 +821,12 @@ implementation
|
|||||||
|
|
||||||
function TACSCustomOutput.GetSuspend : Boolean;
|
function TACSCustomOutput.GetSuspend : Boolean;
|
||||||
begin
|
begin
|
||||||
Result := Thread.bSuspend;
|
Result := Thread.Suspended;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TACSCustomOutput.SetSuspend(v : Boolean);
|
procedure TACSCustomOutput.SetSuspend(v : Boolean);
|
||||||
begin
|
begin
|
||||||
Thread.bSuspend := v;
|
Thread.Suspended:=v;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TACSStreamedInput.Create;
|
constructor TACSStreamedInput.Create;
|
||||||
@@ -1160,20 +1159,17 @@ implementation
|
|||||||
|
|
||||||
constructor TACSThread.Create;
|
constructor TACSThread.Create;
|
||||||
begin
|
begin
|
||||||
bSuspend := False;
|
|
||||||
inherited Create(True);
|
inherited Create(True);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TACSThread.DoPause;
|
procedure TACSThread.DoPause;
|
||||||
begin
|
begin
|
||||||
If not Suspended then Suspended := True;
|
If not Suspended then Suspended := True;
|
||||||
bSuspend := true;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TACSThread.DoResume;
|
procedure TACSThread.DoResume;
|
||||||
begin
|
begin
|
||||||
If Suspended then Suspended := False;
|
If Suspended then Suspended := False;
|
||||||
bSuspend := false;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
|
Reference in New Issue
Block a user