Fixes crashes related to closing tabs with splits

Summary:
If you moved the tabs to splits in a way that you have a different
number of tabs in each split, and started closing it, the count()
of the tabs would be different and we would hit an assert.

The fix is simple: don't separate the logic between tabEmpty and
tabDestroyed, if the tab is empty it will be destroyed but we can
treat everything in the tabEmpty signal, this way we will never hit
a dangling pointer.

Because of that it was possible that a splitView had a invalid
activeWidget for a microsecond, when it's deleting itself, so
instead of asserting if we have no active view, I choose to return
a empty list of properties.

Reviewers: hindenburg, ngraham, sandsmark

Reviewed By: hindenburg

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D15379
This commit is contained in:
Tomaz Canabrava
2018-09-16 13:59:37 -04:00
committed by Kurt Hindenburg
parent 8fd74e8b74
commit 6330bb82bb
4 changed files with 13 additions and 26 deletions

View File

@@ -877,8 +877,10 @@ QList<ViewProperties *> ViewManager::viewProperties() const
QList<ViewProperties *> list;
TabbedViewContainer *container = _viewSplitter->activeContainer();
if (container == nullptr) {
return {};
}
Q_ASSERT(container);
list.reserve(container->count());
for(int i = 0, end = container->count(); i < end; i++) {