diff data/model/FFTModel.cpp @ 1784:4eac4bf35b45

More graceful handling of failure to construct FFT models in the case where the source model has already been deleted before this occurs
author Chris Cannam
date Tue, 17 Sep 2019 11:21:33 +0100
parents 6d6740b075c3
children dd51797e528e
line wrap: on
line diff
--- a/data/model/FFTModel.cpp	Tue Sep 17 10:42:55 2019 +0100
+++ b/data/model/FFTModel.cpp	Tue Sep 17 11:21:33 2019 +0100
@@ -71,6 +71,8 @@
                 this, SIGNAL(modelChanged(ModelId)));
         connect(model.get(), SIGNAL(modelChangedWithin(ModelId, sv_frame_t, sv_frame_t)),
                 this, SIGNAL(modelChangedWithin(ModelId, sv_frame_t, sv_frame_t)));
+    } else {
+        m_error = QString("Model #%1 is not available").arg(m_model.untyped);
     }
 }
 
@@ -82,7 +84,15 @@
 FFTModel::isOK() const
 {
     auto model = ModelById::getAs<DenseTimeValueModel>(m_model);
-    return (model && model->isOK());
+    if (!model) {
+        m_error = QString("Model #%1 is not available").arg(m_model.untyped);
+        return false;
+    }
+    if (!model->isOK()) {
+        m_error = QString("Model #%1 is not OK").arg(m_model.untyped);
+        return false;
+    }
+    return true;
 }
 
 int