diff framework/Document.cpp @ 79:b1a68403714b

* Further model lifecycle fixes
author Chris Cannam
date Thu, 24 Jan 2008 11:03:59 +0000
parents 58bfaaed07ed
children 0948bf800422
line wrap: on
line diff
--- a/framework/Document.cpp	Wed Jan 23 18:09:50 2008 +0000
+++ b/framework/Document.cpp	Thu Jan 24 11:03:59 2008 +0000
@@ -79,8 +79,8 @@
 		std::cerr << "Document::~Document: WARNING: Main model is also"
 			  << " in models list!" << std::endl;
 	    } else if (model) {
+                model->aboutToDelete();
 		emit modelAboutToBeDeleted(model);
-                model->aboutToDelete();
 		delete model;
 	    }
 	    m_models.erase(m_models.begin());
@@ -92,8 +92,8 @@
 	      << std::endl;
 #endif
     if (m_mainModel) {
+        m_mainModel->aboutToDelete();
         emit modelAboutToBeDeleted(m_mainModel);
-        m_mainModel->aboutToDelete();
     }
 
     emit mainModelChanged(0);
@@ -377,8 +377,8 @@
     }
 
     if (oldMainModel) {
+        oldMainModel->aboutToDelete();
         emit modelAboutToBeDeleted(oldMainModel);
-        oldMainModel->aboutToDelete();
     }
 
     emit mainModelChanged(m_mainModel);
@@ -509,8 +509,8 @@
 		      << "their source fields appropriately" << std::endl;
 	}
 
+        model->aboutToDelete();
 	emit modelAboutToBeDeleted(model);
-        model->aboutToDelete();
 	m_models.erase(model);
 	delete model;
     }