diff data/model/FFTModel.cpp @ 1686:e73baeead27f single-point

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 c9a15ee5dc1d
children d08b560102a1
line wrap: on
line diff
--- a/data/model/FFTModel.cpp	Wed Apr 03 16:19:20 2019 +0100
+++ 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) {