Skip to content

Commit 7bed735

Browse files
committed
fix: some crashes found in uploaded crash reports
1 parent 508b139 commit 7bed735

File tree

2 files changed

+60
-55
lines changed

2 files changed

+60
-55
lines changed

source/apphelpers.pas

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,8 +2366,6 @@ function MessageDialog(const Title, Msg: string; DlgType: TMsgDlgType; Buttons:
23662366
end;
23672367
if Title <> Dialog.Caption then
23682368
Dialog.Title := Title;
2369-
if Assigned(MainForm) and (MainForm.ActiveConnection <> nil) then
2370-
Dialog.Caption := MainForm.ActiveConnection.Parameters.SessionName + ': ' + Dialog.Caption;
23712369
rx := TRegExpr.Create;
23722370
rx.Expression := 'https?://[^\s"]+';
23732371
if ThemeIsDark then

source/main.pas

Lines changed: 60 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -9434,65 +9434,72 @@ procedure TMainForm.DBtreeGetText(Sender: TBaseVirtualTree; Node:
94349434
Bytes: Int64;
94359435
AllListsCached: Boolean;
94369436
begin
9437-
DBObj := Sender.GetNodeData(Node);
9438-
case Column of
9439-
0: case DBObj.NodeType of
9440-
lntNone: CellText := DBObj.Connection.Parameters.SessionPath;
9441-
lntDb: CellText := DBObj.Database;
9442-
lntGroup: begin
9443-
CellText := DBObj.Name;
9444-
if Sender.ChildrenInitialized[Node] then
9445-
CellText := CellText + ' (' + FormatNumber(Sender.ChildCount[Node]) + ')';
9446-
end;
9447-
lntTable..lntEvent: try
9448-
if (DBObj.Schema <> '') and (DBObj.Connection.Parameters.NetTypeGroup = ngMSSQL) then
9449-
CellText := DBObj.Schema + '.' + DBObj.Name
9450-
else
9437+
try
9438+
DBObj := Sender.GetNodeData(Node);
9439+
case Column of
9440+
0: case DBObj.NodeType of
9441+
lntNone: CellText := DBObj.Connection.Parameters.SessionPath;
9442+
lntDb: CellText := DBObj.Database;
9443+
lntGroup: begin
94519444
CellText := DBObj.Name;
9452-
except
9453-
CellText := DBObj.Name;
9445+
if Sender.ChildrenInitialized[Node] then
9446+
CellText := CellText + ' (' + FormatNumber(Sender.ChildCount[Node]) + ')';
9447+
end;
9448+
lntTable..lntEvent: try
9449+
if (DBObj.Schema <> '') and (DBObj.Connection.Parameters.NetTypeGroup = ngMSSQL) then
9450+
CellText := DBObj.Schema + '.' + DBObj.Name
9451+
else
9452+
CellText := DBObj.Name;
9453+
except
9454+
CellText := DBObj.Name;
9455+
end;
9456+
lntColumn: CellText := DBObj.Column;
94549457
end;
9455-
lntColumn: CellText := DBObj.Column;
9456-
end;
9457-
1: if DBObj.Connection.Active then case DBObj.NodeType of
9458-
// Calculate and display the sum of all table sizes in ALL dbs if all table lists are cached
9459-
lntNone: begin
9460-
AllListsCached := true;
9461-
for i:=0 to DBObj.Connection.AllDatabases.Count-1 do begin
9462-
if not DBObj.Connection.DbObjectsCached(DBObj.Connection.AllDatabases[i]) then begin
9463-
AllListsCached := false;
9464-
break;
9465-
end;
9466-
end;
9467-
// Will be also set to a negative value by GetTableSize and results of SHOW TABLES
9468-
Bytes := -1;
9469-
if AllListsCached then begin
9470-
Bytes := 0;
9458+
1: if DBObj.Connection.Active then case DBObj.NodeType of
9459+
// Calculate and display the sum of all table sizes in ALL dbs if all table lists are cached
9460+
lntNone: begin
9461+
AllListsCached := true;
94719462
for i:=0 to DBObj.Connection.AllDatabases.Count-1 do begin
9472-
DBObjects := DBObj.Connection.GetDBObjects(DBObj.Connection.AllDatabases[i]);
9473-
Inc(Bytes, DBObjects.DataSize);
9463+
if not DBObj.Connection.DbObjectsCached(DBObj.Connection.AllDatabases[i]) then begin
9464+
AllListsCached := false;
9465+
break;
9466+
end;
94749467
end;
9468+
// Will be also set to a negative value by GetTableSize and results of SHOW TABLES
9469+
Bytes := -1;
9470+
if AllListsCached then begin
9471+
Bytes := 0;
9472+
for i:=0 to DBObj.Connection.AllDatabases.Count-1 do begin
9473+
DBObjects := DBObj.Connection.GetDBObjects(DBObj.Connection.AllDatabases[i]);
9474+
Inc(Bytes, DBObjects.DataSize);
9475+
end;
9476+
end;
9477+
if Bytes >= 0 then CellText := FormatByteNumber(Bytes)
9478+
else CellText := '';
94759479
end;
9476-
if Bytes >= 0 then CellText := FormatByteNumber(Bytes)
9477-
else CellText := '';
9478-
end;
9479-
// Calculate and display the sum of all table sizes in ONE db, if the list is already cached.
9480-
lntDb: begin
9481-
if not DBObj.Connection.DbObjectsCached(DBObj.Database) then
9482-
CellText := ''
9483-
else begin
9484-
DBObjects := DBObj.Connection.GetDBObjects(DBObj.Database);
9485-
CellText := FormatByteNumber(DBObjects.DataSize);
9480+
// Calculate and display the sum of all table sizes in ONE db, if the list is already cached.
9481+
lntDb: begin
9482+
if not DBObj.Connection.DbObjectsCached(DBObj.Database) then
9483+
CellText := ''
9484+
else begin
9485+
DBObjects := DBObj.Connection.GetDBObjects(DBObj.Database);
9486+
CellText := FormatByteNumber(DBObjects.DataSize);
9487+
end;
94869488
end;
9487-
end;
9488-
lntTable: begin
9489-
if DBObj.Size >= 0 then
9490-
CellText := FormatByteNumber(DBObj.Size)
9491-
else
9492-
CellText := '';
9493-
end
9494-
else CellText := ''; // Applies for views/procs/... which have no size
9495-
end;
9489+
lntTable: begin
9490+
if DBObj.Size >= 0 then
9491+
CellText := FormatByteNumber(DBObj.Size)
9492+
else
9493+
CellText := '';
9494+
end
9495+
else CellText := ''; // Applies for views/procs/... which have no size
9496+
end;
9497+
end;
9498+
except
9499+
// Uploaded crash reports show multiple different situations with an AV,
9500+
// some of them in conjunction with a killed query.
9501+
on E:EAccessViolation do
9502+
CellText := '';
94969503
end;
94979504
end;
94989505

0 commit comments

Comments
 (0)