diff data/fft/FFTDataServer.h @ 215:a051929fef3b

* Attempt to improve management of FFT models that are not currently in use. I think these are some problems with this at the moment.
author Chris Cannam
date Fri, 19 Jan 2007 14:38:57 +0000
parents 91fdc752e540
children 7f8ffe65d453
line wrap: on
line diff
--- a/data/fft/FFTDataServer.h	Fri Jan 19 13:13:14 2007 +0000
+++ b/data/fft/FFTDataServer.h	Fri Jan 19 14:38:57 2007 +0000
@@ -29,6 +29,7 @@
 #include <deque>
 
 class DenseTimeValueModel;
+class Model;
 class FFTCache;
 
 class FFTDataServer
@@ -55,6 +56,8 @@
     static void claimInstance(FFTDataServer *);
     static void releaseInstance(FFTDataServer *);
 
+    static void modelAboutToBeDeleted(Model *);
+
     const DenseTimeValueModel *getModel() const { return m_model; }
     int        getChannel() const { return m_channel; }
     WindowType getWindowType() const { return m_windower.getType(); }
@@ -196,8 +199,10 @@
 
     typedef std::pair<FFTDataServer *, int> ServerCountPair;
     typedef std::map<QString, ServerCountPair> ServerMap;
+    typedef std::deque<FFTDataServer *> ServerQueue;
 
     static ServerMap m_servers;
+    static ServerQueue m_releasedServers; // these are still in m_servers as well, with zero refcount
     static QMutex m_serverMapMutex;
     static FFTDataServer *findServer(QString); // call with serverMapMutex held
     static void purgeLimbo(int maxSize = 3); // call with serverMapMutex held