@@ -12178,7 +12178,8 @@ constructor TBaseVirtualTree.Create(AOwner: TComponent);
12178
12178
//----------------------------------------------------------------------------------------------------------------------
12179
12179
12180
12180
destructor TBaseVirtualTree.Destroy;
12181
-
12181
+ var
12182
+ WasValidating: Boolean;
12182
12183
begin
12183
12184
// Disconnect all remote MSAA connections
12184
12185
if Assigned(FAccessibleItem) then begin
@@ -12190,7 +12191,10 @@ destructor TBaseVirtualTree.Destroy;
12190
12191
fAccessible := nil;
12191
12192
end;
12192
12193
12194
+ WasValidating := (tsValidating in FStates);
12193
12195
InterruptValidation(True);
12196
+ if WasValidating then
12197
+ CheckSynchronize(); // Make sure to dequeue all synchronized calls from ChangeTreeStatesAsync(), fixes mem leak reported in issue #1001.
12194
12198
Exclude(FOptions.FMiscOptions, toReadOnly);
12195
12199
// Make sure there is no reference remaining to the releasing tree.
12196
12200
TWorkerThread.ReleaseThreadReference();
@@ -25705,7 +25709,7 @@ procedure TBaseVirtualTree.ValidateCache();
25705
25709
25706
25710
begin
25707
25711
// stop validation if it is currently validating this tree's cache.
25708
- InterruptValidation(False );
25712
+ InterruptValidation();
25709
25713
25710
25714
FStartIndex := 0;
25711
25715
if (tsValidationNeeded in FStates) and (FVisibleCount > CacheThreshold) then
@@ -32628,7 +32632,7 @@ procedure TBaseVirtualTree.UpdateHorizontalScrollBar(DoRepaint: Boolean);
32628
32632
begin
32629
32633
UpdateHorizontalRange;
32630
32634
32631
- if (tsUpdating in FStates ) or not HandleAllocated then
32635
+ if (FUpdateCount > 0 ) or not HandleAllocated then
32632
32636
Exit;
32633
32637
32634
32638
// Adjust effect scroll offset depending on bidi mode.
@@ -32735,7 +32739,7 @@ procedure TBaseVirtualTree.UpdateVerticalScrollBar(DoRepaint: Boolean);
32735
32739
begin
32736
32740
UpdateVerticalRange;
32737
32741
32738
- if tsUpdating in FStates then
32742
+ if (fUpdateCount > 0) then
32739
32743
Exit;
32740
32744
Assert(GetCurrentThreadId = MainThreadId, 'UI controls like ' + Classname + ' and its scrollbars should only be manipulated through the main thread.');
32741
32745
0 commit comments