diff framework/SVFileReader.cpp @ 220:0b1886cee2cf templating

Merge from default branch
author Chris Cannam
date Wed, 27 Apr 2011 11:33:48 +0100
parents fe83e6e68683
children 67cea66bd588
line wrap: on
line diff
--- a/framework/SVFileReader.cpp	Fri Oct 15 12:08:34 2010 +0100
+++ b/framework/SVFileReader.cpp	Wed Apr 27 11:33:48 2011 +0100
@@ -412,8 +412,18 @@
     
     for (std::set<Model *>::iterator i = unaddedModels.begin();
          i != unaddedModels.end(); ++i) {
-        m_document->addImportedModel(*i);
-        m_addedModels.insert(*i);
+        Model *model = *i;
+        // don't want to add these models, because their lifespans
+        // are entirely dictated by the models that "own" them even
+        // though they were read independently from the .sv file.
+        // (pity we don't have a nicer way)
+        if (!dynamic_cast<PathModel *>(model) &&
+            !dynamic_cast<AlignmentModel *>(model)) {
+            m_document->addImportedModel(model);
+        }
+        // but we add all models here, so they don't get deleted
+        // when the file loader is destroyed
+        m_addedModels.insert(model);
     }
 }