From f2095095c2f2853d704eaf2bc03ee4d203df2aa1 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Thu, 16 Oct 2025 20:41:46 +0200 Subject: [PATCH] fix: prevent crash in auto-refresh action Exit out of refresh action early when the users mouse is dragging or resizing a tree column Closes #1060 --- source/main.pas | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/source/main.pas b/source/main.pas index b6c8d9e8..e2f4791f 100644 --- a/source/main.pas +++ b/source/main.pas @@ -4771,9 +4771,24 @@ var List: TVirtualStringTree; OldDbObject: TDBObject; DoProceed: Boolean; + i: Integer; +const + HeaderDragStates: THeaderStates = [ + hsAutoSizing, hsDragging, hsDragPending, hsColumnWidthTracking, hsColumnWidthTrackPending, hsHeightTracking, hsHeightTrackPending, hsResizing + ]; begin // Refresh - // Force data tab update when appropriate. + + // Do not refresh when *any* tree is dragged or resized by user in this moment. + // This is not limited to the focused control, as we also refresh ListDatabases if only its tab is active. + for i:=0 to ComponentCount-1 do begin + if not(Components[i] is TVirtualStringTree) then + continue; + if (HeaderDragStates * TVirtualStringTree(Components[i]).Header.States <> []) then begin + Exit; + end; + end; + // Disable refresh action and re-enable in ApplicationOnIdle event tab1 := PageControlMain.ActivePage; actRefresh.Enabled := False;