Skip to content

Commit 2e01b4d

Browse files
joachimmardermodersohn
authored andcommitted
Chnages related to issue JAM-Software#1001:
* TWorkerThread.ReleaseThreadReference() calls CheckSynchronize() to Make sure code queued in the main thread by TBaseVirtualTree.ChangeTreeStatesAsync() get processed before the tree is being destroyed. * Removed unused property CurrentTree from TWorkerThread.
1 parent 6e90a83 commit 2e01b4d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Source/VirtualTrees.WorkerThread.pas

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ TWorkerThread = class(TThread)
2828

2929
class procedure AddTree(Tree: TBaseVirtualTree);
3030
class procedure RemoveTree(Tree: TBaseVirtualTree);
31-
32-
property CurrentTree: TBaseVirtualTree read FCurrentTree;
3331
end;
3432

3533

@@ -98,6 +96,7 @@ class procedure TWorkerThread.ReleaseThreadReference(ACanBlock: Boolean);
9896
WorkerThread.Dispose(ACanBlock);
9997
end;
10098
end;
99+
CheckSynchronize(); // Make sure code queued in the main thread by TBaseVirtualTree.ChangeTreeStatesAsync() get processed before the tree is being destroyed. issue #1001
101100
end;
102101

103102
//----------------------------------------------------------------------------------------------------------------------
@@ -180,7 +179,7 @@ procedure TWorkerThread.Execute();
180179
EnterStates := [tsUseCache];
181180

182181
finally
183-
FCurrentTree := nil; //Clear variable to prevent deadlock in CancelValidation. See #434
182+
FCurrentTree := nil; //Clear variable to prevent deadlock in WaitForValidationTermination()
184183
TBaseVirtualTreeCracker(lCurrentTree).ChangeTreeStatesAsync(EnterStates, [tsValidating, tsStopValidation]);
185184
Queue(TBaseVirtualTreeCracker(lCurrentTree).UpdateEditBounds);
186185
end;

0 commit comments

Comments
 (0)