Fix konsole crashes when rearranging split views

I'll try to explain here what I saw in this bug.
Following the BUG instructions, drag the terminal[2] and drop
(here the "drop event" starts)
-> the dragged terminal "ViewSplitter" become scheduled for deletion,
but it will only happens when it is in event loop.
-> And of course it is not in event loop yet, it is still the
"drop event" and it call the "addTerminalDisplay" to add the dragged
 terminal to a "ViewSplitter".
-> This makes count() counts this scheduled for deletion "ViewSplitter"
 and goes to the wrong "if".
-> It adds the "ViewSplitter" with the terminals into a
"marked for deletion" one, finishes the "drop event" and enters
event loop (a crash without a memleak! everything in the tab
 is properly deleted).

BUG: 411741
BUG: 412596
FIXED-IN: 20.12
wilder
Carlos Alves 5 years ago committed by Kurt Hindenburg
parent 7e99f5cf93
commit c33eba8c60
  1. 4
      src/widgets/ViewSplitter.cpp

@ -137,6 +137,10 @@ void ViewSplitter::childEvent(QChildEvent *event)
if (event->removed()) {
if (count() == 0) {
auto *parent_splitter = qobject_cast<ViewSplitter *>(parentWidget());
if (parent_splitter != nullptr) {
setParent(nullptr);
}
deleteLater();
}
if (findChild<TerminalDisplay*>() == nullptr) {

Loading…
Cancel
Save