changeset 350:3a55cd576334

* Further model lifecycle fixes
author Chris Cannam
date Thu, 24 Jan 2008 11:03:59 +0000
parents 369a197737c7
children b548a36f7633
files layer/SpectrumLayer.cpp
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/layer/SpectrumLayer.cpp	Wed Jan 23 15:43:27 2008 +0000
+++ b/layer/SpectrumLayer.cpp	Thu Jan 24 11:03:59 2008 +0000
@@ -63,6 +63,14 @@
 
     m_originModel = model;
 
+    if (m_sliceableModel) {
+        Model *m = const_cast<Model *>
+            (static_cast<const Model *>(m_sliceableModel));
+        m->aboutToDelete();
+        setSliceableModel(0);
+        delete m;
+    }
+
     m_newFFTNeeded = true;
 
     emit layerParametersChanged();
@@ -646,7 +654,7 @@
 {
     if (!m_originModel || !m_originModel->isOK() ||
         !m_originModel->isReady()) {
-        std::cerr << "SpectrumLayer::paint: no origin model" << std::endl;
+        std::cerr << "SpectrumLayer::paint: no origin model, or origin model not OK or not ready" << std::endl;
         return;
     }