Skip to content

Commit 4837405

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 05886c4 commit 4837405

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
@@ -1532,6 +1532,7 @@ procedure FixVT(VT: TVirtualStringTree; MultiLineCount: Word=1);
15321532
VT.EndUpdate;
15331533
VT.TextMargin := 6;
15341534
VT.Margin := 2;
1535+
VT.DefaultText := '-'; // "Node" by default
15351536
// Disable hottracking in non-Vista mode, looks ugly in XP, but nice in Vista
15361537
if (toUseExplorerTheme in VT.TreeOptions.PaintOptions) and (Win32MajorVersion >= 6) then
15371538
VT.TreeOptions.PaintOptions := VT.TreeOptions.PaintOptions + [toHotTrack]

source/main.pas

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9456,6 +9456,8 @@ procedure TMainForm.HostListGetImageIndex(Sender: TBaseVirtualTree; Node: PVirtu
94569456
if Sender = ListProcesses then begin
94579457
Idx := Sender.GetNodeData(Node);
94589458
Results := GridResult(Sender);
9459+
if not Results.Connection.Active then
9460+
Exit;
94599461
Results.RecNo := Idx^;
94609462
case Kind of
94619463
ikNormal, ikSelected: begin
@@ -9500,11 +9502,15 @@ procedure TMainForm.HostListGetText(Sender: TBaseVirtualTree; Node: PVirtualNode
95009502
begin
95019503
Idx := Sender.GetNodeData(Node);
95029504
Results := GridResult(Sender);
9503-
// See issue #3416
9504-
if (Results = nil) and (Sender <> ListVariables) then
9505-
Exit;
9506-
if Results <> nil then
9505+
9506+
// See issue #3416. Note: ListVariables does not depend on a live result, but on a StringList.
9507+
if Sender <> ListVariables then begin
9508+
// See issue #1875
9509+
if (Results = nil) or (not Results.Connection.Active) then
9510+
Exit;
95079511
Results.RecNo := Idx^;
9512+
end;
9513+
95089514

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

0 commit comments

Comments
 (0)