View Issue Details

IDProjectCategoryView StatusLast Update
0004207JEDI VCL00 JVCL Componentspublic2007-08-22 01:38
ReporterAlexBAssigned Toobones 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
Product Version 
Target VersionFixed in Version 
Summary0004207: Fix in TJvBaseThread.Execute for QC#26291.
DescriptionHi all.
Fix in TJvBaseThread.Execute for QC#26291, file TJvThread.pas.
Works on my side.

procedure TJvBaseThread.Execute;
begin
  try
    FExecuteIsActive := True;
    if FInternalTerminate then
      Self.Terminate;
    FExecuteEvent(Self, FParams);
  except
    on E: Exception do
    begin
      FException := E;
      FExceptionAddr := ExceptAddr;
      Self.Synchronize(ExceptionHandler);
    end;
  end;

  // workaround for QC#26291
  if FreeOnTerminate and (Suspended=True) then
    repeat
     Sleep(0);
    until (Suspended=False);
end;
Additional InformationQC#26291:

procedure TThread.Resume;
...
    SuspendCount := ResumeThread(FHandle);
    CheckThreadError(SuspendCount >= 0);
    if SuspendCount = 1 then
      FSuspended := False;
...

If FreeOnTerminate=true and Execute is too fast then assignment "FSuspended:=False;" can occur for already deleted object.
TagsNo tags attached.

Activities

AlexB

2007-08-19 23:12

reporter   ~0013644

Yesterday I was too hasty. Workaround in itself is good but it's not necessary in our case: we have internally assigned OnTerminate which works in main thread via Synchronize, therefore the main thread always has time for assigning of FSuspended.

jfudickar

2007-08-21 12:52

developer   ~0013645

Does it mean, we can close it?

AlexB

2007-08-21 21:21

reporter   ~0013646

Yes of course.

Issue History

Date Modified Username Field Change
2007-08-19 03:18 AlexB New Issue
2007-08-19 23:12 AlexB Note Added: 0013644
2007-08-21 12:52 jfudickar Note Added: 0013645
2007-08-21 21:21 AlexB Note Added: 0013646
2007-08-22 01:37 obones Status new => resolved
2007-08-22 01:37 obones Resolution open => no change required
2007-08-22 01:37 obones Assigned To => obones