Skip to content

Commit 1029657

Browse files
committed
fix: several crash causes Host subtabs when connection is lost externally
This also changes the dodgy default text "Node" in any VirtualTree's cell to "-" Refs #1875
1 parent 5e34fa9 commit 1029657

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

source/apphelpers.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,7 @@ procedure FixVT(VT: TVirtualStringTree; IsResultGrid: Boolean=False);
14911491
end;
14921492
VT.EndUpdate;
14931493
end;
1494+
VT.DefaultText := '-'; // "Node" by default
14941495
{$IFNDEF WINDOWS}
14951496
// Disable grid lines, looks ok on Windows with dotted light lines, but not on macOS and Linux
14961497
if (toHotTrack in VT.TreeOptions.PaintOptions) then

source/main.pas

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9208,6 +9208,8 @@ procedure TMainForm.HostListGetImageIndex(Sender: TBaseVirtualTree; Node: PVirtu
92089208
if Sender = ListProcesses then begin
92099209
Idx := Sender.GetNodeData(Node);
92109210
Results := GridResult(Sender);
9211+
if not Results.Connection.Active then
9212+
Exit;
92119213
Results.RecNo := Idx^;
92129214
case Kind of
92139215
ikNormal, ikSelected: begin
@@ -9252,11 +9254,15 @@ procedure TMainForm.HostListGetText(Sender: TBaseVirtualTree; Node: PVirtualNode
92529254
begin
92539255
Idx := Sender.GetNodeData(Node);
92549256
Results := GridResult(Sender);
9255-
// See issue #3416
9256-
if (Results = nil) and (Sender <> ListVariables) then
9257-
Exit;
9258-
if Results <> nil then
9257+
9258+
// See issue #3416. Note: ListVariables does not depend on a live result, but on a StringList.
9259+
if Sender <> ListVariables then begin
9260+
// See issue #1875
9261+
if (Results = nil) or (not Results.Connection.Active) then
9262+
Exit;
92599263
Results.RecNo := Idx^;
9264+
end;
9265+
92609266

92619267
if (Sender = ListStatus) and (Column in [1,2,3]) then begin
92629268
CellText := Results.Col(1);

0 commit comments

Comments
 (0)