Mercurial > hg > svgui
diff view/PaneStack.cpp @ 728:596414d20ef0 tonioni
Fix failure to delete property stack when pane is deleted (sometimes). Fixes Tony crash bug #881, needs to go in SV as well.
author | Chris Cannam |
---|---|
date | Tue, 04 Mar 2014 15:28:32 +0000 |
parents | 67b167bb60ab |
children | b6dc57688c72 |
line wrap: on
line diff
--- a/view/PaneStack.cpp Mon Feb 24 17:04:48 2014 -0500 +++ b/view/PaneStack.cpp Tue Mar 04 15:28:32 2014 +0000 @@ -247,11 +247,16 @@ void PaneStack::deletePane(Pane *pane) { + cerr << "PaneStack::deletePane(" << pane << ")" << endl; + std::vector<PaneRec>::iterator i; bool found = false; + QWidget *stack = 0; + for (i = m_panes.begin(); i != m_panes.end(); ++i) { if (i->pane == pane) { + stack = i->propertyStack; m_panes.erase(i); found = true; break; @@ -262,6 +267,7 @@ for (i = m_hiddenPanes.begin(); i != m_hiddenPanes.end(); ++i) { if (i->pane == pane) { + stack = i->propertyStack; m_hiddenPanes.erase(i); found = true; break; @@ -276,6 +282,18 @@ emit paneAboutToBeDeleted(pane); + cerr << "PaneStack::deletePane: about to delete parent " << pane->parent() << " of pane " << pane << endl; + + // The property stack associated with the parent was initially + // created with the same parent as it, so it would be deleted when + // we delete the pane's parent in a moment -- but it may have been + // reparented depending on the layout. We'd better delete it + // separately first. (This fixes a crash on opening a new layer + // with a new unit type in it, when a long-defunct property box + // could be signalled from the unit database to tell it that a new + // unit had appeared.) + delete stack; + delete pane->parent(); if (m_currentPane == pane) {