Commit c33eba8c authored by Carlos Alves's avatar Carlos Alves Committed by Kurt Hindenburg

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
parent 7e99f5cf
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment