Mercurial > hg > svapp
changeset 52:43ad8d909e28
* Fix #1815930 new crash, just introduced!
author | Chris Cannam |
---|---|
date | Fri, 02 Nov 2007 14:12:17 +0000 |
parents | e41af8419d4a |
children | de2b3c6479c8 |
files | framework/Document.cpp framework/Document.h framework/MainWindowBase.cpp |
diffstat | 3 files changed, 24 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/framework/Document.cpp Thu Nov 01 17:24:38 2007 +0000 +++ b/framework/Document.cpp Fri Nov 02 14:12:17 2007 +0000 @@ -55,7 +55,7 @@ // std::cerr << "\n\nDocument::~Document: about to clear command history" << std::endl; CommandHistory::getInstance()->clear(); -// std::cerr << "Document::~Document: about to delete layers" << std::endl; + std::cerr << "Document::~Document: about to delete layers" << std::endl; while (!m_layers.empty()) { deleteLayer(*m_layers.begin(), true); } @@ -101,6 +101,10 @@ newLayer->setObjectName(getUniqueLayerName(newLayer->objectName())); m_layers.insert(newLayer); + + std::cerr << "Document::createLayer: Added layer of type " << type + << ", now have " << m_layers.size() << " layers" << std::endl; + emit layerAdded(newLayer); return newLayer; @@ -141,6 +145,10 @@ setChannel(newLayer, -1); m_layers.insert(newLayer); + + std::cerr << "Document::createImportedLayer: Added layer of type " << type + << ", now have " << m_layers.size() << " layers" << std::endl; + emit layerAdded(newLayer); return newLayer; } @@ -248,6 +256,9 @@ // using one of these. Carry out this replacement before we // delete any of the models. + std::cerr << "Document::setMainModel: Have " + << m_layers.size() << " layers" << std::endl; + for (LayerSet::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { Layer *layer = *i; @@ -503,6 +514,9 @@ m_layers.erase(layer); + std::cerr << "Document::deleteLayer: Removing, now have " + << m_layers.size() << " layers" << std::endl; + releaseModel(layer->getModel()); emit layerRemoved(layer); emit layerAboutToBeDeleted(layer);
--- a/framework/Document.h Thu Nov 01 17:24:38 2007 +0000 +++ b/framework/Document.h Fri Nov 02 14:12:17 2007 +0000 @@ -119,6 +119,14 @@ QString configurationXml); /** + * Delete the given layer, and also its associated model if no + * longer used by any other layer. In general, this should be the + * only method used to delete layers -- doing so directly is a bit + * of a social gaffe. + */ + void deleteLayer(Layer *, bool force = false); + + /** * Set the main model (the source for playback sample rate, etc) * to the given wave file model. This will regenerate any derived * models that were based on the previous main model. @@ -230,14 +238,6 @@ void releaseModel(Model *model); /** - * Delete the given layer, and also its associated model if no - * longer used by any other layer. In general, this should be the - * only method used to delete layers -- doing so directly is a bit - * of a social gaffe. - */ - void deleteLayer(Layer *, bool force = false); - - /** * If model is suitable for alignment, align it against the main * model and store the alignment in the model. (If the model has * an alignment already for the current main model, leave it
--- a/framework/MainWindowBase.cpp Thu Nov 01 17:24:38 2007 +0000 +++ b/framework/MainWindowBase.cpp Fri Nov 02 14:12:17 2007 +0000 @@ -1126,8 +1126,7 @@ if (!il->addImage(m_viewManager->getGlobalCentreFrame(), source.getLocation())) { if (newLayer) { - m_document->setModel(il, 0); // releasing its model - delete il; + m_document->deleteLayer(il); // also releases its model } return FileOpenFailed; } else {