changeset 362:cc4eb32efc6c

* Further model lifecycle fixes
author Chris Cannam
date Thu, 24 Jan 2008 11:03:59 +0000
parents 399ea254afd6
children 0e30c8ec15a0
files data/fft/FFTDataServer.cpp data/model/FFTModel.cpp
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/data/fft/FFTDataServer.cpp	Wed Jan 23 18:09:50 2008 +0000
+++ b/data/fft/FFTDataServer.cpp	Thu Jan 24 11:03:59 2008 +0000
@@ -453,7 +453,8 @@
 #endif
 
             if (i->second.second > 0) {
-                std::cerr << "ERROR: FFTDataServer::modelAboutToBeDeleted: Model " << model << " (\"" << model->objectName().toStdString() << "\") is about to be deleted, but is still being referred to by FFT server " << server << " with non-zero refcount " << i->second.second << std::endl;
+                std::cerr << "WARNING: FFTDataServer::modelAboutToBeDeleted: Model " << model << " (\"" << model->objectName().toStdString() << "\") is about to be deleted, but is still being referred to by FFT server " << server << " with non-zero refcount " << i->second.second << std::endl;
+                return;
             }
             for (ServerQueue::iterator j = m_releasedServers.begin();
                  j != m_releasedServers.end(); ++j) {
--- a/data/model/FFTModel.cpp	Wed Jan 23 18:09:50 2008 +0000
+++ b/data/model/FFTModel.cpp	Thu Jan 24 11:03:59 2008 +0000
@@ -86,6 +86,11 @@
 FFTModel::sourceModelAboutToBeDeleted()
 {
     if (m_sourceModel) {
+        std::cerr << "FFTModel[" << this << "]::sourceModelAboutToBeDeleted(" << m_sourceModel << ")" << std::endl;
+        if (m_server) {
+            FFTDataServer::releaseInstance(m_server);
+            m_server = 0;
+        }
         FFTDataServer::modelAboutToBeDeleted(m_sourceModel);
     }
 }