diff data/model/FFTModel.cpp @ 1688:901f37d32060

Model deletion issues - the AlignmentModel doesn't actually need to know about the input aggregate model; the document should own it instead
author Chris Cannam
date Thu, 04 Apr 2019 11:15:43 +0100
parents 70e172e6cc59
children d08b560102a1
line wrap: on
line diff
--- a/data/model/FFTModel.cpp	Wed Feb 27 12:31:12 2019 +0000
+++ b/data/model/FFTModel.cpp	Thu Apr 04 11:15:43 2019 +0100
@@ -61,9 +61,12 @@
 
     m_fft.initFloat();
 
-    connect(model, SIGNAL(modelChanged()), this, SIGNAL(modelChanged()));
+    connect(model, SIGNAL(modelChanged()),
+            this, SIGNAL(modelChanged()));
     connect(model, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)),
             this, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)));
+    connect(model, SIGNAL(aboutToBeDeleted()),
+            this, SLOT(sourceModelAboutToBeDeleted()));
 }
 
 FFTModel::~FFTModel()
@@ -273,6 +276,8 @@
 FFTModel::getSourceDataUncached(pair<sv_frame_t, sv_frame_t> range) const
 {
     Profiler profiler("FFTModel::getSourceDataUncached");
+
+    if (!m_model) return {};
     
     decltype(range.first) pfx = 0;
     if (range.first < 0) {