comparison framework/Align.cpp @ 677:4d26b66931f8

Abandon aggregate models on deletion (e.g. when document is replaced during processing)
author Chris Cannam
date Tue, 11 Jun 2019 13:39:50 +0100
parents b375fdbb74bc
children 16c1077da62c
comparison
equal deleted inserted replaced
676:0d4236961c97 677:4d26b66931f8
199 199
200 TuningDiffRec rec; 200 TuningDiffRec rec;
201 rec.input = aggregateModel; 201 rec.input = aggregateModel;
202 rec.alignment = alignmentModel; 202 rec.alignment = alignmentModel;
203 203
204 connect(aggregateModel, SIGNAL(aboutToBeDeleted()),
205 this, SLOT(aggregateModelAboutToBeDeleted()));
206
204 // This model exists only so that the AlignmentModel can get a 207 // This model exists only so that the AlignmentModel can get a
205 // completion value from somewhere while the tuning difference 208 // completion value from somewhere while the tuning difference
206 // calculation is going on 209 // calculation is going on
207 rec.preparatory = new SparseTimeValueModel 210 rec.preparatory = new SparseTimeValueModel
208 (aggregateModel->getSampleRate(), 1);; 211 (aggregateModel->getSampleRate(), 1);;
211 214
212 m_pendingTuningDiffs[tdout] = rec; 215 m_pendingTuningDiffs[tdout] = rec;
213 } 216 }
214 217
215 return true; 218 return true;
219 }
220
221 void
222 Align::aggregateModelAboutToBeDeleted()
223 {
224 SVCERR << "Align::aggregateModelAboutToBeDeleted" << endl;
225
226 QObject *s = sender();
227 AggregateWaveModel *awm = qobject_cast<AggregateWaveModel *>(s);
228 if (!awm) return;
229 QMutexLocker locker(&m_mutex);
230
231 SVCERR << "Align::aggregateModelAboutToBeDeleted: awm = " << awm
232 << endl;
233
234 for (const auto &p : m_pendingTuningDiffs) {
235 if (p.second.input == awm) {
236 SVCERR << "we have a record of this, getting rid of it" << endl;
237 m_pendingTuningDiffs.erase(p.first);
238 return;
239 }
240 }
216 } 241 }
217 242
218 void 243 void
219 Align::tuningDifferenceCompletionChanged() 244 Align::tuningDifferenceCompletionChanged()
220 { 245 {