Skip to content

Commit 7650efe

Browse files
committed
fix: two crashes in QT caused by aggressive control repainting
Refs #2270
1 parent f2b2dc3 commit 7650efe

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

source/main.pas

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,8 @@ procedure TMainForm.ShowStatusMsg(Msg: String=''; PanelNr: Integer=6);
14451445
if (PanelNr = 6) and (not IsWine) then begin
14461446
// Immediately repaint this special panel, as it holds critical update messages,
14471447
// while avoiding StatusBar.Repaint which refreshes all panels
1448-
StatusBar.Repaint;
1448+
// Caution: statusbar.Repaint crashes with QT here. See issue #2270
1449+
StatusBar.InvalidatePanel(6, [ppText]);
14491450
end;
14501451
end;
14511452
end;
@@ -9117,6 +9118,7 @@ procedure TMainForm.ApplyVTFilter(FromTimer: Boolean);
91179118
var
91189119
Node: PVirtualNode;
91199120
VT: TVirtualStringTree;
9121+
TreeIsInsideUpdate: Boolean;
91209122
i: Integer;
91219123
match: Boolean;
91229124
tab: TTabSheet;
@@ -9162,6 +9164,7 @@ procedure TMainForm.ApplyVTFilter(FromTimer: Boolean);
91629164
end;
91639165
if not Assigned(VT) then
91649166
Exit;
9167+
TreeIsInsideUpdate := tsUpdating in VT.TreeStates;
91659168
// Loop through all nodes and hide non matching
91669169
Node := VT.GetFirst;
91679170
rx := TRegExpr.Create;
@@ -9181,9 +9184,11 @@ procedure TMainForm.ApplyVTFilter(FromTimer: Boolean);
91819184
// Display hour glass instead of X icon
91829185
OldImageIndex := editFilterVT.ImageIndex;
91839186
editFilterVT.ImageIndex := 150;
9184-
editFilterVT.Repaint;
9187+
// Caution: edit.Repaint crashes with QT here. See issue #2270
9188+
editFilterVT.Invalidate;
91859189

9186-
VT.BeginUpdate;
9190+
if not TreeIsInsideUpdate then
9191+
VT.BeginUpdate;
91879192
while Assigned(Node) do begin
91889193
// Don't filter anything if the filter text is empty
91899194
match := rx.Expression = '';
@@ -9199,7 +9204,8 @@ procedure TMainForm.ApplyVTFilter(FromTimer: Boolean);
91999204
inc(VisibleCount);
92009205
Node := VT.GetNext(Node);
92019206
end;
9202-
VT.EndUpdate;
9207+
if not TreeIsInsideUpdate then
9208+
VT.EndUpdate;
92039209
if rx.Expression <> '' then begin
92049210
lblFilterVTInfo.Caption := f_('%0:d out of %1:d matching. %2:d hidden.', [VisibleCount, VT.RootNodeCount, VT.RootNodeCount - VisibleCount]);
92059211
end else

0 commit comments

Comments
 (0)