diff framework/Document.cpp @ 112:e54dff673096

* Fix crash when aligning
author Chris Cannam
date Wed, 30 Apr 2008 16:58:19 +0000
parents c82913d31a53
children 3b61a975b47e
line wrap: on
line diff
--- a/framework/Document.cpp	Tue Apr 29 15:34:17 2008 +0000
+++ b/framework/Document.cpp	Wed Apr 30 16:58:19 2008 +0000
@@ -831,14 +831,15 @@
     components.push_back(AggregateWaveModel::ModelChannelSpec
                          (rm, -1));
 
-    Model *aggregate = new AggregateWaveModel(components);
+    Model *aggregateModel = new AggregateWaveModel(components);
+    ModelTransformer::Input aggregate(aggregateModel);
 
     TransformId id = "vamp:match-vamp-plugin:match:path"; //!!! configure
     
     TransformFactory *tf = TransformFactory::getInstance();
 
     Transform transform = tf->getDefaultTransformFor
-        (id, aggregate->getSampleRate());
+        (id, aggregateModel->getSampleRate());
 
     transform.setStepSize(transform.getBlockSize()/2);
     transform.setParameter("serialise", 1);
@@ -862,12 +863,14 @@
         std::cerr << "Document::alignModel: ERROR: Failed to create alignment path (no MATCH plugin?)" << std::endl;
         emit alignmentFailed(id, message);
         delete transformOutput;
-        delete aggregate;
+        delete aggregateModel;
         return;
     }
 
+    path->setCompletion(0);
+
     AlignmentModel *alignmentModel = new AlignmentModel
-        (m_mainModel, model, aggregate, path);
+        (m_mainModel, model, aggregateModel, path);
 
     rm->setAlignment(alignmentModel);
 }