changeset 760:5b4206f7d7d4

Remove model from pan layer when it's about to be deleted, fixing #1035
author Chris Cannam
date Wed, 13 Aug 2014 16:10:36 +0100
parents e2d2ac12577c
children 956134fa9f24
files main/MainWindow.cpp main/MainWindow.h
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Wed Aug 13 16:09:11 2014 +0100
+++ b/main/MainWindow.cpp	Wed Aug 13 16:10:36 2014 +0100
@@ -4147,6 +4147,19 @@
 }
 
 void
+MainWindow::modelAboutToBeDeleted(Model *model)
+{
+    if (model == m_panLayer->getModel()) {
+        if (model == getMainModel()) {
+            m_panLayer->setModel(0);
+        } else {
+            m_panLayer->setModel(getMainModel());
+        }
+    }
+    MainWindowBase::modelAboutToBeDeleted(model);
+}
+
+void
 MainWindow::setInstantsNumbering()
 {
     QAction *a = dynamic_cast<QAction *>(sender());
--- a/main/MainWindow.h	Wed Aug 13 16:09:11 2014 +0100
+++ b/main/MainWindow.h	Wed Aug 13 16:10:36 2014 +0100
@@ -132,6 +132,7 @@
 
     virtual void mainModelChanged(WaveFileModel *);
     virtual void modelAdded(Model *);
+    virtual void modelAboutToBeDeleted(Model *);
 
     virtual void showLayerTree();
     virtual void showActivityLog();