Fix crash on close

Authored by Aurélien Gâteau <agateau@kde.org> on Jun 19 2014, 2:24 PM.

Description

Fix crash on close

Move code responsible for 'forgetting' a view outside of code responding to the
TerminalDisplay deletion.

This avoids a loop like this:

~MainWindow

> ~QStackedWidget

> ~TerminalDisplay

> QObject::destroyed

> ViewContainer::viewDestroyed

> ViewContainer::removeViewWidget

  • internal cleanup
  • try to remove TerminalDisplay from QStackedWidget which is being deleted and

crash

Instead the code now does:

~MainWindow

> ~QStackedWidget

> ~TerminalDisplay

> QObject::destroyed

> ViewContainer::viewDestroyed

> ViewContainer::forgetView (does the internal clean up)

And if one tries to explicitly remove a view, sequence is:

ViewContainer::removeView

> ViewContainer::forgetView

> ViewContainer::removeViewWidget

The patch also removes ViewManager::focusActiveView() because it causes a crash
when closing a TerminalDisplay as it tries to put the focus on the deleted
TerminalDisplay. I initially called it through a queued connection, but realized
it is actually not needed for focus to be passed to the correct view, so just
removed it.

BUG: 331724
REVIEW: 118839

Details

Committed
Aurélien Gâteau <agateau@kde.org>Jun 20 2014, 12:01 PM
Parents
R319:8212a7d7360b: update boxs.txt which uses more box lines for testing purposes
Branches
Unknown
Tags
Unknown
Aurélien Gâteau <agateau@kde.org> committed R319:dd1b2b4df04f: Fix crash on close (authored by Aurélien Gâteau <agateau@kde.org>).Jun 20 2014, 12:01 PM