cleanup up cleanup at session destruction; clarify the meaning of 3 signals (DropRefe...
[ardour.git] / libs / ardour / audio_playlist.cc
index 812aa8783ba301f22989ae9da79d7d29da3af484..1ecba28653f615f44838ed73c4a0c83c42bd8a45 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <cstdlib>
 
-#include <sigc++/bind.h>
 
 #include "ardour/types.h"
 #include "ardour/configuration.h"
@@ -35,7 +34,6 @@
 #include "i18n.h"
 
 using namespace ARDOUR;
-using namespace sigc;
 using namespace std;
 using namespace PBD;
 
@@ -46,7 +44,7 @@ AudioPlaylist::AudioPlaylist (Session& session, const XMLNode& node, bool hidden
        assert(!prop || DataType(prop->value()) == DataType::AUDIO);
 
        in_set_state++;
-       set_state (node);
+       set_state (node, Stateful::loading_state_version);
        in_set_state--;
 }
 
@@ -104,12 +102,6 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, nfra
 
 AudioPlaylist::~AudioPlaylist ()
 {
-       GoingAway (); /* EMIT SIGNAL */
-
-       /* drop connections to signals */
-
-       notify_callbacks ();
-
        _crossfades.clear ();
 }
 
@@ -351,7 +343,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
        boost::shared_ptr<AudioRegion> top;
        boost::shared_ptr<AudioRegion> bottom;
        boost::shared_ptr<Crossfade>   xfade;
-       RegionList*  touched_regions;
+       RegionList*  touched_regions = 0;
 
        if (in_set_state || in_partition) {
                return;
@@ -401,6 +393,9 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
 
                OverlapType c = top->coverage (bottom->position(), bottom->last_frame());
 
+               delete touched_regions;
+               touched_regions = 0;
+
                try {
                        switch (c) {
                        case OverlapNone:
@@ -509,6 +504,8 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
                }
 
        }
+
+       delete touched_regions;
 }
 
 void
@@ -527,8 +524,8 @@ AudioPlaylist::add_crossfade (boost::shared_ptr<Crossfade> xfade)
        } else {
                _crossfades.push_back (xfade);
 
-               xfade->Invalidated.connect (mem_fun (*this, &AudioPlaylist::crossfade_invalidated));
-               xfade->StateChanged.connect (mem_fun (*this, &AudioPlaylist::crossfade_changed));
+               xfade->Invalidated.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
+               xfade->StateChanged.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
 
                notify_crossfade_added (xfade);
        }
@@ -566,7 +563,7 @@ AudioPlaylist::set_state (const XMLNode& node, int version)
 
        in_set_state++;
 
-       Playlist::set_state (node);
+       Playlist::set_state (node, version);
 
        freeze ();
 
@@ -583,8 +580,8 @@ AudioPlaylist::set_state (const XMLNode& node, int version)
                try {
                        boost::shared_ptr<Crossfade> xfade = boost::shared_ptr<Crossfade> (new Crossfade (*((const Playlist *)this), *child));
                        _crossfades.push_back (xfade);
-                       xfade->Invalidated.connect (mem_fun (*this, &AudioPlaylist::crossfade_invalidated));
-                       xfade->StateChanged.connect (mem_fun (*this, &AudioPlaylist::crossfade_changed));
+                       xfade->Invalidated.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
+                       xfade->StateChanged.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
                        NewCrossfade(xfade);
                }
 
@@ -787,7 +784,7 @@ AudioPlaylist::crossfades_at (nframes_t frame, Crossfades& clist)
 }
 
 void
-AudioPlaylist::foreach_crossfade (sigc::slot<void, boost::shared_ptr<Crossfade> > s)
+AudioPlaylist::foreach_crossfade (boost::function<void (boost::shared_ptr<Crossfade>)> s)
 {
        RegionLock rl (this, false);
        for (Crossfades::iterator i = _crossfades.begin(); i != _crossfades.end(); ++i) {