# HG changeset patch # User Chris Cannam # Date 1393947148 0 # Node ID 25b3d5802e6ed0003a5353623543b1eec67d1367 # Parent c27a3604fe6f1fd02aa115a6b2dec3cae3b3b844 Fix failure to delete property stack when pane is deleted (sometimes) diff -r c27a3604fe6f -r 25b3d5802e6e view/Pane.cpp --- 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 diff -r c27a3604fe6f -r 25b3d5802e6e view/PaneStack.cpp --- 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::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) { diff -r c27a3604fe6f -r 25b3d5802e6e view/View.cpp --- 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() +{ +} diff -r c27a3604fe6f -r 25b3d5802e6e view/View.h --- 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); diff -r c27a3604fe6f -r 25b3d5802e6e widgets/PropertyBox.cpp --- 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; diff -r c27a3604fe6f -r 25b3d5802e6e widgets/PropertyStack.cpp --- 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() { diff -r c27a3604fe6f -r 25b3d5802e6e widgets/PropertyStack.h --- 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;