Skip to content

Commit 110b6d8

Browse files
committed
Reverted some recent changes für issue #1001 that caused a potential deadlock in case CheckSynchronize() is called nested.
1 parent 6687954 commit 110b6d8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Source/VirtualTrees.WorkerThread.pas

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class procedure TWorkerThread.EnsureCreated();
5757
WorkerThread := TWorkerThread.Create();
5858
end;
5959

60-
class procedure TWorkerThread.Dispose;
60+
class procedure TWorkerThread.Dispose(CanBlock: Boolean);
6161
var
6262
LRef: TThread;
6363
begin
@@ -168,14 +168,14 @@ procedure TWorkerThread.Execute();
168168
if Assigned(lCurrentTree) then
169169
begin
170170
try
171-
FCurrentTree := lCurrentTree;
172171
TBaseVirtualTreeCracker(lCurrentTree).ChangeTreeStatesAsync([tsValidating], [tsUseCache, tsValidationNeeded]);
172+
FCurrentTree := lCurrentTree;
173173
EnterStates := [];
174174
if not (tsStopValidation in FCurrentTree.TreeStates) and TBaseVirtualTreeCracker(FCurrentTree).DoValidateCache then
175175
EnterStates := [tsUseCache];
176176
finally
177+
FCurrentTree := nil; // Important: Clear variable before calling ChangeTreeStatesAsync() to prevent deadlock in WaitForValidationTermination(). See issue #1001
177178
TBaseVirtualTreeCracker(lCurrentTree).ChangeTreeStatesAsync(EnterStates, [tsValidating, tsStopValidation]);
178-
FCurrentTree := nil; // Important: Clear variable before calling ChangeTreeStatesAsync() to prevent deadlock in WaitForValidationTermination()
179179
end;
180180
end;
181181
except

0 commit comments

Comments
 (0)