comparison framework/SVFileReader.cpp @ 212:fe83e6e68683

* Fix crash on document deletion (new session, or application exit) after loading session with alignments
author Chris Cannam
date Sun, 24 Oct 2010 22:09:42 +0200
parents b35c7af2e1d0
children 67cea66bd588
comparison
equal deleted inserted replaced
211:84422236db20 212:fe83e6e68683
410 } 410 }
411 } 411 }
412 412
413 for (std::set<Model *>::iterator i = unaddedModels.begin(); 413 for (std::set<Model *>::iterator i = unaddedModels.begin();
414 i != unaddedModels.end(); ++i) { 414 i != unaddedModels.end(); ++i) {
415 m_document->addImportedModel(*i); 415 Model *model = *i;
416 m_addedModels.insert(*i); 416 // don't want to add these models, because their lifespans
417 // are entirely dictated by the models that "own" them even
418 // though they were read independently from the .sv file.
419 // (pity we don't have a nicer way)
420 if (!dynamic_cast<PathModel *>(model) &&
421 !dynamic_cast<AlignmentModel *>(model)) {
422 m_document->addImportedModel(model);
423 }
424 // but we add all models here, so they don't get deleted
425 // when the file loader is destroyed
426 m_addedModels.insert(model);
417 } 427 }
418 } 428 }
419 429
420 bool 430 bool
421 SVFileReader::readModel(const QXmlAttributes &attributes) 431 SVFileReader::readModel(const QXmlAttributes &attributes)