comparison 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
comparison
equal deleted inserted replaced
1783:cf3eb6252f42 1784:4eac4bf35b45
69 69
70 connect(model.get(), SIGNAL(modelChanged(ModelId)), 70 connect(model.get(), SIGNAL(modelChanged(ModelId)),
71 this, SIGNAL(modelChanged(ModelId))); 71 this, SIGNAL(modelChanged(ModelId)));
72 connect(model.get(), SIGNAL(modelChangedWithin(ModelId, sv_frame_t, sv_frame_t)), 72 connect(model.get(), SIGNAL(modelChangedWithin(ModelId, sv_frame_t, sv_frame_t)),
73 this, SIGNAL(modelChangedWithin(ModelId, sv_frame_t, sv_frame_t))); 73 this, SIGNAL(modelChangedWithin(ModelId, sv_frame_t, sv_frame_t)));
74 } else {
75 m_error = QString("Model #%1 is not available").arg(m_model.untyped);
74 } 76 }
75 } 77 }
76 78
77 FFTModel::~FFTModel() 79 FFTModel::~FFTModel()
78 { 80 {
80 82
81 bool 83 bool
82 FFTModel::isOK() const 84 FFTModel::isOK() const
83 { 85 {
84 auto model = ModelById::getAs<DenseTimeValueModel>(m_model); 86 auto model = ModelById::getAs<DenseTimeValueModel>(m_model);
85 return (model && model->isOK()); 87 if (!model) {
88 m_error = QString("Model #%1 is not available").arg(m_model.untyped);
89 return false;
90 }
91 if (!model->isOK()) {
92 m_error = QString("Model #%1 is not OK").arg(m_model.untyped);
93 return false;
94 }
95 return true;
86 } 96 }
87 97
88 int 98 int
89 FFTModel::getCompletion() const 99 FFTModel::getCompletion() const
90 { 100 {