# HG changeset patch # User Chris Cannam # Date 1393946912 0 # Node ID 596414d20ef0526efd32027ed5ea953fe206fe8d # Parent 4eb741d63161b077d2b6c213c782c1f16299e201 Fix failure to delete property stack when pane is deleted (sometimes). Fixes Tony crash bug #881, needs to go in SV as well. diff -r 4eb741d63161 -r 596414d20ef0 view/Pane.cpp --- a/view/Pane.cpp Mon Feb 24 17:04:48 2014 -0500 +++ b/view/Pane.cpp Tue Mar 04 15:28:32 2014 +0000 @@ -90,8 +90,7 @@ updateHeadsUpDisplay(); - -// SVDEBUG << "Pane::Pane(" << this << ") returning" << endl; + cerr << "Pane::Pane(" << this << ") returning" << endl; } void diff -r 4eb741d63161 -r 596414d20ef0 view/PaneStack.cpp --- 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::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) { diff -r 4eb741d63161 -r 596414d20ef0 view/View.cpp --- a/view/View.cpp Mon Feb 24 17:04:48 2014 -0500 +++ b/view/View.cpp Tue Mar 04 15:28:32 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 4eb741d63161 -r 596414d20ef0 view/View.h --- a/view/View.h Mon Feb 24 17:04:48 2014 -0500 +++ b/view/View.h Tue Mar 04 15:28:32 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 4eb741d63161 -r 596414d20ef0 widgets/PropertyBox.cpp --- a/widgets/PropertyBox.cpp Mon Feb 24 17:04:48 2014 -0500 +++ b/widgets/PropertyBox.cpp Tue Mar 04 15:28:32 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) { @@ -563,7 +563,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 4eb741d63161 -r 596414d20ef0 widgets/PropertyStack.cpp --- a/widgets/PropertyStack.cpp Mon Feb 24 17:04:48 2014 -0500 +++ b/widgets/PropertyStack.cpp Tue Mar 04 15:28:32 2014 +0000 @@ -74,6 +74,10 @@ m_client, SLOT(propertyContainerSelected(View *, PropertyContainer *))); } +PropertyStack::~PropertyStack() +{ +} + void PropertyStack::repopulate() { diff -r 4eb741d63161 -r 596414d20ef0 widgets/PropertyStack.h --- a/widgets/PropertyStack.h Mon Feb 24 17:04:48 2014 -0500 +++ b/widgets/PropertyStack.h Tue Mar 04 15:28:32 2014 +0000 @@ -31,6 +31,7 @@ public: PropertyStack(QWidget *parent, View *client); + virtual ~PropertyStack(); View *getClient() { return m_client; } bool containsContainer(PropertyContainer *container) const;