Fixed memory leak while recording due to rec region state saved every
authorSampo Savolainen <v2@iki.fi>
Sat, 5 Aug 2006 17:48:01 +0000 (17:48 +0000)
committerSampo Savolainen <v2@iki.fi>
Sat, 5 Aug 2006 17:48:01 +0000 (17:48 +0000)
time the fake region was updated. Now any StateManager object can
implement a should_save_state() which controls whether the state of the
object should be saved.

git-svn-id: svn://localhost/ardour2/trunk@760 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/state_manager.h
libs/ardour/state_manager.cc

index 19ee2e624aa2f0edc6065110b5ad1b05a39cf9a8..99bfcfc3ceed22055d93be3a364791deab644db6 100644 (file)
@@ -35,6 +35,8 @@ class StateManager : public sigc::trackable
 
        state_id_t _current_state_id;
 
+       virtual bool should_save_state () const { return true; }
+
        static void prohibit_save ();
        static void allow_save (const char* why, bool dosave);
 
index bcffe381c382be341f3ef1b90c7d89b82f4383f2..153773ed30c8cc54778b69793de93b03d144126f 100644 (file)
@@ -72,6 +72,9 @@ StateManager::use_state (state_id_t id)
 void
 StateManager::save_state (std::string why)
 {
+       if (!should_save_state())
+               return;
+
        if (!_allow_save) {
                SaveAllowed.connect (mem_fun (*this, &StateManager::save_state));
                return;