# HG changeset patch # User Chris Cannam # Date 1560256790 -3600 # Node ID 4d26b66931f879aa61dce47a02ea1ac3035913af # Parent 0d4236961c97678034ceb66cb56b84b2c85fdaaa Abandon aggregate models on deletion (e.g. when document is replaced during processing) diff -r 0d4236961c97 -r 4d26b66931f8 framework/Align.cpp --- a/framework/Align.cpp Tue Jun 11 13:39:17 2019 +0100 +++ b/framework/Align.cpp Tue Jun 11 13:39:50 2019 +0100 @@ -201,6 +201,9 @@ rec.input = aggregateModel; rec.alignment = alignmentModel; + connect(aggregateModel, SIGNAL(aboutToBeDeleted()), + this, SLOT(aggregateModelAboutToBeDeleted())); + // This model exists only so that the AlignmentModel can get a // completion value from somewhere while the tuning difference // calculation is going on @@ -216,6 +219,28 @@ } void +Align::aggregateModelAboutToBeDeleted() +{ + SVCERR << "Align::aggregateModelAboutToBeDeleted" << endl; + + QObject *s = sender(); + AggregateWaveModel *awm = qobject_cast(s); + if (!awm) return; + QMutexLocker locker(&m_mutex); + + SVCERR << "Align::aggregateModelAboutToBeDeleted: awm = " << awm + << endl; + + for (const auto &p : m_pendingTuningDiffs) { + if (p.second.input == awm) { + SVCERR << "we have a record of this, getting rid of it" << endl; + m_pendingTuningDiffs.erase(p.first); + return; + } + } +} + +void Align::tuningDifferenceCompletionChanged() { QMutexLocker locker (&m_mutex); diff -r 0d4236961c97 -r 4d26b66931f8 framework/Align.h --- a/framework/Align.h Tue Jun 11 13:39:17 2019 +0100 +++ b/framework/Align.h Tue Jun 11 13:39:50 2019 +0100 @@ -96,6 +96,7 @@ void alignmentCompletionChanged(); void tuningDifferenceCompletionChanged(); void alignmentProgramFinished(int, QProcess::ExitStatus); + void aggregateModelAboutToBeDeleted(); private: static QString getAlignmentTransformName();