Mercurial > hg > svgui
changeset 729:25b3d5802e6e
Fix failure to delete property stack when pane is deleted (sometimes)
author | Chris Cannam |
---|---|
date | Tue, 04 Mar 2014 15:32:28 +0000 |
parents | c27a3604fe6f |
children | 88a16eed3338 |
files | view/Pane.cpp view/PaneStack.cpp view/View.cpp view/View.h widgets/PropertyBox.cpp widgets/PropertyStack.cpp widgets/PropertyStack.h |
diffstat | 7 files changed, 35 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/view/Pane.cpp Thu Feb 06 18:34:43 2014 +0000 +++ b/view/Pane.cpp Tue Mar 04 15:32:28 2014 +0000 @@ -85,8 +85,7 @@ updateHeadsUpDisplay(); - -// SVDEBUG << "Pane::Pane(" << this << ") returning" << endl; + cerr << "Pane::Pane(" << this << ") returning" << endl; } void
--- a/view/PaneStack.cpp Thu Feb 06 18:34:43 2014 +0000 +++ b/view/PaneStack.cpp Tue Mar 04 15:32:28 2014 +0000 @@ -236,11 +236,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; @@ -251,6 +256,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; @@ -265,6 +271,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) {
--- a/view/View.cpp Thu Feb 06 18:34:43 2014 +0000 +++ b/view/View.cpp Tue Mar 04 15:32:28 2014 +0000 @@ -64,12 +64,12 @@ m_manager(0), m_propertyContainer(new ViewPropertyContainer(this)) { - SVDEBUG << "View::View(" << this << ")" << endl; +// cerr << "View::View(" << this << ")" << endl; } View::~View() { -// SVDEBUG << "View::~View(" << this << ")" << endl; +// cerr << "View::~View(" << this << ")" << endl; m_deleting = true; delete m_propertyContainer; @@ -2407,7 +2407,11 @@ ViewPropertyContainer::ViewPropertyContainer(View *v) : m_v(v) { +// cerr << "ViewPropertyContainer: " << this << " is owned by View " << v << endl; connect(m_v, SIGNAL(propertyChanged(PropertyContainer::PropertyName)), this, SIGNAL(propertyChanged(PropertyContainer::PropertyName))); } +ViewPropertyContainer::~ViewPropertyContainer() +{ +}
--- a/view/View.h Thu Feb 06 18:34:43 2014 +0000 +++ b/view/View.h Tue Mar 04 15:32:28 2014 +0000 @@ -401,6 +401,8 @@ public: ViewPropertyContainer(View *v); + virtual ~ViewPropertyContainer(); + PropertyList getProperties() const { return m_v->getProperties(); } QString getPropertyLabel(const PropertyName &n) const { return m_v->getPropertyLabel(n);
--- a/widgets/PropertyBox.cpp Thu Feb 06 18:34:43 2014 +0000 +++ b/widgets/PropertyBox.cpp Tue Mar 04 15:32:28 2014 +0000 @@ -117,7 +117,7 @@ PropertyBox::populateViewPlayFrame() { #ifdef DEBUG_PROPERTY_BOX - cerr << "PropertyBox(" << m_container << ")::populateViewPlayFrame" << endl; + cerr << "PropertyBox[" << this << ":" << m_container << "]::populateViewPlayFrame" << endl; #endif if (m_viewPlayFrame) { @@ -561,7 +561,9 @@ void PropertyBox::unitDatabaseChanged() { +#ifdef DEBUG_PROPERTY_BOX cerr << "PropertyBox[" << this << "]: unitDatabaseChanged" << endl; +#endif blockSignals(true); // cerr << "my container is " << m_container << endl;
--- a/widgets/PropertyStack.cpp Thu Feb 06 18:34:43 2014 +0000 +++ b/widgets/PropertyStack.cpp Tue Mar 04 15:32:28 2014 +0000 @@ -74,6 +74,10 @@ m_client, SLOT(propertyContainerSelected(View *, PropertyContainer *))); } +PropertyStack::~PropertyStack() +{ +} + void PropertyStack::repopulate() {
--- a/widgets/PropertyStack.h Thu Feb 06 18:34:43 2014 +0000 +++ b/widgets/PropertyStack.h Tue Mar 04 15:32:28 2014 +0000 @@ -31,6 +31,7 @@ public: PropertyStack(QWidget *parent, View *client); + virtual ~PropertyStack(); View *getClient() { return m_client; } bool containsContainer(PropertyContainer *container) const;