summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/session.h10
-rw-r--r--libs/ardour/ardour/session_handle.h1
-rw-r--r--libs/ardour/audio_diskstream.cc2
-rw-r--r--libs/ardour/audio_playlist.cc4
-rw-r--r--libs/ardour/automation_list.cc1
-rw-r--r--libs/ardour/coreaudiosource.cc1
-rw-r--r--libs/ardour/diskstream.cc4
-rw-r--r--libs/ardour/internal_send.cc2
-rw-r--r--libs/ardour/ladspa_plugin.cc2
-rw-r--r--libs/ardour/lv2_plugin.cc2
-rw-r--r--libs/ardour/midi_diskstream.cc2
-rw-r--r--libs/ardour/midi_playlist.cc3
-rw-r--r--libs/ardour/midi_ui.cc2
-rw-r--r--libs/ardour/named_selection.cc5
-rw-r--r--libs/ardour/plugin_insert.cc1
-rw-r--r--libs/ardour/port_insert.cc1
-rw-r--r--libs/ardour/region.cc14
-rw-r--r--libs/ardour/return.cc1
-rw-r--r--libs/ardour/route.cc1
-rw-r--r--libs/ardour/route_group.cc2
-rw-r--r--libs/ardour/send.cc1
-rw-r--r--libs/ardour/session.cc78
-rw-r--r--libs/ardour/session_handle.cc16
-rw-r--r--libs/ardour/session_playlists.cc3
-rw-r--r--libs/ardour/session_state.cc5
-rw-r--r--libs/ardour/sndfilesource.cc2
-rw-r--r--libs/ardour/vst_plugin.cc1
27 files changed, 70 insertions, 97 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 59a282fe1d..ae9c1f58a5 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -570,11 +570,11 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
/* named selections */
- NamedSelection* named_selection_by_name (std::string name);
- void add_named_selection (NamedSelection *);
- void remove_named_selection (NamedSelection *);
+ boost::shared_ptr<NamedSelection> named_selection_by_name (std::string name);
+ void add_named_selection (boost::shared_ptr<NamedSelection>);
+ void remove_named_selection (boost::shared_ptr<NamedSelection>);
- template<class T> void foreach_named_selection (T& obj, void (T::*func)(NamedSelection&));
+ template<class T> void foreach_named_selection (T& obj, void (T::*func)(boost::shared_ptr<NamedSelection>));
PBD::Signal0<void> NamedSelectionAdded;
PBD::Signal0<void> NamedSelectionRemoved;
@@ -1287,7 +1287,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
/* NAMED SELECTIONS */
mutable Glib::Mutex named_selection_lock;
- typedef std::set<NamedSelection *> NamedSelectionList;
+ typedef std::set<boost::shared_ptr<NamedSelection> > NamedSelectionList;
NamedSelectionList named_selections;
int load_named_selections (const XMLNode&);
diff --git a/libs/ardour/ardour/session_handle.h b/libs/ardour/ardour/session_handle.h
index 87c6fb6670..87de244e42 100644
--- a/libs/ardour/ardour/session_handle.h
+++ b/libs/ardour/ardour/session_handle.h
@@ -34,6 +34,7 @@ class SessionHandleRef : public PBD::ScopedConnectionList
protected:
ARDOUR::Session& _session;
virtual void session_going_away ();
+ virtual void insanity_check ();
};
class SessionHandlePtr
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index f8dc553ae0..fb225671e9 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -1505,7 +1505,7 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca
continue; /* XXX is this OK? */
}
- region->GoingAway.connect_same_thread (*this, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region)));
+ region->DropReferences.connect_same_thread (*this, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region)));
_last_capture_regions.push_back (region);
diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc
index 3379868d60..1ecba28653 100644
--- a/libs/ardour/audio_playlist.cc
+++ b/libs/ardour/audio_playlist.cc
@@ -102,10 +102,6 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, nfra
AudioPlaylist::~AudioPlaylist ()
{
- drop_references ();
-
- /* drop connections to signals */
-
_crossfades.clear ();
}
diff --git a/libs/ardour/automation_list.cc b/libs/ardour/automation_list.cc
index 3543f8b51f..3ecf3f0172 100644
--- a/libs/ardour/automation_list.cc
+++ b/libs/ardour/automation_list.cc
@@ -112,7 +112,6 @@ AutomationList::AutomationList (const XMLNode& node, Evoral::Parameter id)
AutomationList::~AutomationList()
{
- drop_references ();
}
boost::shared_ptr<Evoral::ControlList>
diff --git a/libs/ardour/coreaudiosource.cc b/libs/ardour/coreaudiosource.cc
index bbb0d8ca89..1b3a77bc39 100644
--- a/libs/ardour/coreaudiosource.cc
+++ b/libs/ardour/coreaudiosource.cc
@@ -90,7 +90,6 @@ CoreAudioSource::init_cafile ()
CoreAudioSource::~CoreAudioSource ()
{
- drop_references ();
}
int
diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc
index a37323de84..7004ef1ed5 100644
--- a/libs/ardour/diskstream.cc
+++ b/libs/ardour/diskstream.cc
@@ -148,7 +148,7 @@ Diskstream::set_route (Route& r)
non_realtime_input_change ();
set_align_style_from_io ();
- _route->GoingAway.connect_same_thread (*this, boost::bind (&Diskstream::route_going_away, this));
+ _route->Destroyed.connect_same_thread (*this, boost::bind (&Diskstream::route_going_away, this));
}
void
@@ -340,7 +340,7 @@ Diskstream::use_playlist (boost::shared_ptr<Playlist> playlist)
}
_playlist->Modified.connect_same_thread (playlist_connections, boost::bind (&Diskstream::playlist_modified, this));
- _playlist->GoingAway.connect_same_thread (playlist_connections, boost::bind (&Diskstream::playlist_deleted, this, boost::weak_ptr<Playlist>(_playlist)));
+ _playlist->DropReferences.connect_same_thread (playlist_connections, boost::bind (&Diskstream::playlist_deleted, this, boost::weak_ptr<Playlist>(_playlist)));
_playlist->RangesMoved.connect_same_thread (playlist_connections, boost::bind (&Diskstream::playlist_ranges_moved, this, _1));
}
diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc
index 368eff2be4..4a4823a29f 100644
--- a/libs/ardour/internal_send.cc
+++ b/libs/ardour/internal_send.cc
@@ -43,7 +43,7 @@ InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, boost:
set_name (sendto->name());
- _send_to->GoingAway.connect_same_thread (*this, boost::bind (&InternalSend::send_to_going_away, this));
+ _send_to->DropReferences.connect_same_thread (*this, boost::bind (&InternalSend::send_to_going_away, this));
_send_to->NameChanged.connect_same_thread (*this, boost::bind (&InternalSend::send_to_name_changed, this));
}
diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc
index bbd29e960e..7abcca2718 100644
--- a/libs/ardour/ladspa_plugin.cc
+++ b/libs/ardour/ladspa_plugin.cc
@@ -144,8 +144,6 @@ LadspaPlugin::~LadspaPlugin ()
deactivate ();
cleanup ();
- drop_references ();
-
/* XXX who should close a plugin? */
// dlclose (module);
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index 6c593a869a..39bd8d75a7 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -181,8 +181,6 @@ LV2Plugin::~LV2Plugin ()
deactivate ();
cleanup ();
- drop_references ();
-
slv2_instance_free(_instance);
slv2_value_free(_name);
slv2_value_free(_author);
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc
index 17c1404358..18d3bc5ce3 100644
--- a/libs/ardour/midi_diskstream.cc
+++ b/libs/ardour/midi_diskstream.cc
@@ -1024,7 +1024,7 @@ MidiDiskstream::transport_stopped (struct tm& /*when*/, time_t /*twhen*/, bool a
continue; /* XXX is this OK? */
}
- region->GoingAway.connect_same_thread (*this, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region)));
+ region->DropReferences.connect_same_thread (*this, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region)));
_last_capture_regions.push_back (region);
diff --git a/libs/ardour/midi_playlist.cc b/libs/ardour/midi_playlist.cc
index a8e60ec866..789c91b236 100644
--- a/libs/ardour/midi_playlist.cc
+++ b/libs/ardour/midi_playlist.cc
@@ -71,9 +71,6 @@ MidiPlaylist::MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, nframes
MidiPlaylist::~MidiPlaylist ()
{
- drop_references ();
-
- /* drop connections to signals */
}
template<typename Time>
diff --git a/libs/ardour/midi_ui.cc b/libs/ardour/midi_ui.cc
index 70be1f345d..aa81ff2068 100644
--- a/libs/ardour/midi_ui.cc
+++ b/libs/ardour/midi_ui.cc
@@ -89,6 +89,8 @@ MidiControlUI::change_midi_ports ()
bool
MidiControlUI::midi_input_handler (IOCondition ioc, MIDI::Port* port)
{
+ DEBUG_TRACE (DEBUG::MidiIO, string_compose ("something happend on %1\n", port->name()));
+
if (ioc & ~IO_IN) {
return false;
}
diff --git a/libs/ardour/named_selection.cc b/libs/ardour/named_selection.cc
index a829c44a50..4bcc3f3b72 100644
--- a/libs/ardour/named_selection.cc
+++ b/libs/ardour/named_selection.cc
@@ -52,8 +52,6 @@ NamedSelection::NamedSelection (string n, PlaylistList& l)
(*i)->set_name (new_name);
(*i)->use();
}
-
- NamedSelectionCreated (this);
}
NamedSelection::NamedSelection (Session& session, const XMLNode& node)
@@ -101,8 +99,9 @@ NamedSelection::NamedSelection (Session& session, const XMLNode& node)
NamedSelection::~NamedSelection ()
{
for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
- (*i)->release ();
+ /* XXX who really owns these? us or the session? */
(*i)->drop_references ();
+ (*i)->release ();
}
}
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index c2bf7f3562..a85cc1ee86 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -130,7 +130,6 @@ PluginInsert::set_count (uint32_t num)
PluginInsert::~PluginInsert ()
{
- drop_references ();
}
void
diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc
index 044230e1f7..dee661db41 100644
--- a/libs/ardour/port_insert.cc
+++ b/libs/ardour/port_insert.cc
@@ -61,7 +61,6 @@ PortInsert::PortInsert (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLN
PortInsert::~PortInsert ()
{
- drop_references ();
}
void
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index d706421c39..57d887f6a6 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -109,7 +109,7 @@ Region::Region (boost::shared_ptr<Source> src, nframes_t start, nframes_t length
_sources.push_back (src);
_master_sources.push_back (src);
- src->GoingAway.connect_same_thread (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(src)));
+ src->DropReferences.connect_same_thread (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(src)));
assert(_sources.size() > 0);
_positional_lock_style = AudioTime;
@@ -338,7 +338,6 @@ Region::Region (boost::shared_ptr<Source> src, const XMLNode& node)
Region::~Region ()
{
DEBUG_TRACE (DEBUG::Destruction, string_compose ("Region %1 destructor @ %2\n", _name, this));
- drop_references ();
}
void
@@ -1416,7 +1415,12 @@ void
Region::source_deleted (boost::weak_ptr<Source>)
{
_sources.clear ();
- cerr << "Send drop ref signal from region " << ' ' << this << endl;
+
+ /* this is a very special case: at least one of the region's
+ sources has bee deleted, so invalidate all references to
+ ourselves.
+ */
+
drop_references ();
}
@@ -1586,14 +1590,14 @@ Region::use_sources (SourceList const & s)
for (SourceList::const_iterator i = s.begin (); i != s.end(); ++i) {
_sources.push_back (*i);
- (*i)->GoingAway.connect_same_thread (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(*i)));
+ (*i)->DropReferences.connect_same_thread (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(*i)));
unique_srcs.insert (*i);
}
for (SourceList::const_iterator i = s.begin (); i != s.end(); ++i) {
_master_sources.push_back (*i);
if (unique_srcs.find (*i) == unique_srcs.end()) {
- (*i)->GoingAway.connect_same_thread (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(*i)));
+ (*i)->DropReferences.connect_same_thread (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(*i)));
}
}
}
diff --git a/libs/ardour/return.cc b/libs/ardour/return.cc
index 991c6ae7d1..c2c227769d 100644
--- a/libs/ardour/return.cc
+++ b/libs/ardour/return.cc
@@ -67,7 +67,6 @@ Return::Return (Session& s, const XMLNode& node, bool internal)
Return::~Return ()
{
- drop_references ();
}
XMLNode&
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index c652023e2c..09e38eaa86 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -792,6 +792,7 @@ Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorList::ite
// XXX: do we want to emit the signal here ? change call order.
processor->activate ();
}
+
processor->ActiveChanged.connect_same_thread (*this, boost::bind (&Session::update_latency_compensation, &_session, false, false));
_output->set_user_latency (0);
diff --git a/libs/ardour/route_group.cc b/libs/ardour/route_group.cc
index 2f946dd620..d59ec82236 100644
--- a/libs/ardour/route_group.cc
+++ b/libs/ardour/route_group.cc
@@ -76,7 +76,7 @@ RouteGroup::add (boost::shared_ptr<Route> r)
routes->push_back (r);
r->join_route_group (this);
- r->GoingAway.connect_same_thread (*this, boost::bind (&RouteGroup::remove_when_going_away, this, boost::weak_ptr<Route> (r)));
+ r->DropReferences.connect_same_thread (*this, boost::bind (&RouteGroup::remove_when_going_away, this, boost::weak_ptr<Route> (r)));
_session.set_dirty ();
changed (); /* EMIT SIGNAL */
diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc
index 1bb03642d0..e4fbf3efba 100644
--- a/libs/ardour/send.cc
+++ b/libs/ardour/send.cc
@@ -64,7 +64,6 @@ Send::Send (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node, i
Send::~Send ()
{
- drop_references ();
}
void
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index a062efee8d..2e48ed0215 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -388,32 +388,19 @@ Session::destroy ()
AudioDiskstream::free_working_buffers();
- DEBUG_TRACE (DEBUG::Destruction, "delete named selections\n");
- for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); ) {
- NamedSelectionList::iterator tmp;
+ /* tell everyone who is still standing that we're about to die */
+ drop_references ();
- tmp = i;
- ++tmp;
+ /* tell everyone to drop references and delete objects as we go */
- delete *i;
- i = tmp;
- }
+ DEBUG_TRACE (DEBUG::Destruction, "delete named selections\n");
+ named_selections.clear ();
DEBUG_TRACE (DEBUG::Destruction, "delete regions\n");
- for (RegionList::iterator i = regions.begin(); i != regions.end(); ) {
- RegionList::iterator tmp;
-
- tmp = i;
- ++tmp;
-
- boost::shared_ptr<Region> keep (i->second);
-
- DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for region %1 (%2); pre-ref = %3\n", i->second->name(), i->second.get(), i->second.use_count()));
+ for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
+ DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for region %1 ; pre-ref = %2\n", i->second->name(), i->second.use_count()));
i->second->drop_references ();
- DEBUG_TRACE(DEBUG::Destruction, string_compose ("region post ref = %1\n", i->second.use_count()));
- i = tmp;
}
-
regions.clear ();
DEBUG_TRACE (DEBUG::Destruction, "delete routes\n");
@@ -427,10 +414,12 @@ Session::destroy ()
{
RCUWriter<RouteList> writer (routes);
boost::shared_ptr<RouteList> r = writer.get_copy ();
+
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for route %1 ; pre-ref = %2\n", (*i)->name(), (*i).use_count()));
(*i)->drop_references ();
}
+
r->clear ();
/* writer goes out of scope and updates master */
}
@@ -444,28 +433,22 @@ Session::destroy ()
DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for diskstream %1 ; pre-ref = %2\n", (*i)->name(), (*i).use_count()));
(*i)->drop_references ();
}
+
dsl->clear ();
}
diskstreams.flush ();
DEBUG_TRACE (DEBUG::Destruction, "delete sources\n");
- for (SourceMap::iterator i = sources.begin(); i != sources.end(); ) {
- SourceMap::iterator tmp;
-
- tmp = i;
- ++tmp;
-
+ for (SourceMap::iterator i = sources.begin(); i != sources.end(); ++i) {
DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for source %1 ; pre-ref = %2\n", i->second->path(), i->second.use_count()));
i->second->drop_references ();
-
- i = tmp;
}
sources.clear ();
-
DEBUG_TRACE (DEBUG::Destruction, "delete route groups\n");
for (list<RouteGroup *>::iterator i = _route_groups.begin(); i != _route_groups.end(); ++i) {
+
delete *i;
}
@@ -476,10 +459,6 @@ Session::destroy ()
/* not strictly necessary, but doing it here allows the shared_ptr debugging to work */
playlists.reset ();
- /* tell everyone who is still standing that we're about to die */
-
- drop_references ();
-
boost_debug_list_ptrs ();
DEBUG_TRACE (DEBUG::Destruction, "Session::destroy() done\n");
@@ -2813,8 +2792,6 @@ Session::add_regions (vector<boost::shared_ptr<Region> >& new_regions)
}
region->StateChanged.connect_same_thread (*this, boost::bind (&Session::region_changed, this, _1, boost::weak_ptr<Region>(region)));
- region->GoingAway.connect_same_thread (*this, boost::bind (&Session::remove_region, this, boost::weak_ptr<Region>(region)));
-
update_region_name_map (region);
}
@@ -3001,7 +2978,6 @@ Session::add_source (boost::shared_ptr<Source> source)
}
if (result.second) {
- source->GoingAway.connect_same_thread (*this, boost::bind (&Session::remove_source, this, boost::weak_ptr<Source> (source)));
set_dirty();
}
@@ -3390,10 +3366,7 @@ Session::add_playlist (boost::shared_ptr<Playlist> playlist, bool unused)
return;
}
- bool existing = playlists->add (playlist);
- if (!existing) {
- playlist->GoingAway.connect_same_thread (*this, boost::bind (&Session::remove_playlist, this, boost::weak_ptr<Playlist>(playlist)));
- }
+ playlists->add (playlist);
if (unused) {
playlist->release();
@@ -3566,7 +3539,11 @@ Session::graph_reordered ()
void
Session::add_processor (Processor* processor)
{
- processor->GoingAway.connect_same_thread (*this, boost::bind (&Session::remove_processor, this, processor));
+ /* Session does not own Processors (they belong to a Route) but we do want to track
+ the arrival and departure of port inserts, sends and returns for naming
+ purposes.
+ */
+ processor->DropReferences.connect_same_thread (*this, boost::bind (&Session::remove_processor, this, processor));
set_dirty();
}
@@ -3810,37 +3787,33 @@ Session::mark_insert_id (uint32_t id)
/* Named Selection management */
-NamedSelection *
+boost::shared_ptr<NamedSelection>
Session::named_selection_by_name (string name)
{
Glib::Mutex::Lock lm (named_selection_lock);
for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); ++i) {
if ((*i)->name == name) {
- return* i;
+ return *i;
}
}
- return 0;
+ return boost::shared_ptr<NamedSelection>();
}
void
-Session::add_named_selection (NamedSelection* named_selection)
+Session::add_named_selection (boost::shared_ptr<NamedSelection> named_selection)
{
{
Glib::Mutex::Lock lm (named_selection_lock);
named_selections.insert (named_selections.begin(), named_selection);
}
- for (list<boost::shared_ptr<Playlist> >::iterator i = named_selection->playlists.begin(); i != named_selection->playlists.end(); ++i) {
- add_playlist (*i);
- }
-
set_dirty();
NamedSelectionAdded (); /* EMIT SIGNAL */
}
void
-Session::remove_named_selection (NamedSelection* named_selection)
+Session::remove_named_selection (boost::shared_ptr<NamedSelection> named_selection)
{
bool removed = false;
@@ -3850,7 +3823,6 @@ Session::remove_named_selection (NamedSelection* named_selection)
NamedSelectionList::iterator i = find (named_selections.begin(), named_selections.end(), named_selection);
if (i != named_selections.end()) {
- delete (*i);
named_selections.erase (i);
set_dirty();
removed = true;
@@ -4186,6 +4158,10 @@ Session::compute_initial_length ()
void
Session::sync_order_keys (std::string const & base)
{
+ if (deletion_in_progress()) {
+ return;
+ }
+
if (!Config->get_sync_all_route_ordering()) {
/* leave order keys as they are */
return;
diff --git a/libs/ardour/session_handle.cc b/libs/ardour/session_handle.cc
index 1cd78c8aac..36515505ac 100644
--- a/libs/ardour/session_handle.cc
+++ b/libs/ardour/session_handle.cc
@@ -32,7 +32,7 @@ SessionHandlePtr::SessionHandlePtr (Session* s)
: _session (s)
{
if (_session) {
- _session->GoingAway.connect_same_thread (_session_connections, boost::bind (&SessionHandlePtr::session_going_away, this));
+ _session->DropReferences.connect_same_thread (_session_connections, boost::bind (&SessionHandlePtr::session_going_away, this));
}
}
@@ -47,7 +47,7 @@ SessionHandlePtr::set_session (Session* s)
if (s) {
_session = s;
- _session->GoingAway.connect_same_thread (_session_connections, boost::bind (&SessionHandlePtr::session_going_away, this));
+ _session->DropReferences.connect_same_thread (_session_connections, boost::bind (&SessionHandlePtr::session_going_away, this));
}
}
@@ -63,11 +63,19 @@ SessionHandlePtr::session_going_away ()
SessionHandleRef::SessionHandleRef (Session& s)
: _session (s)
{
- _session.GoingAway.connect_same_thread (*this, boost::bind (&SessionHandleRef::session_going_away, this));
+ _session.DropReferences.connect_same_thread (*this, boost::bind (&SessionHandleRef::session_going_away, this));
+ _session.Destroyed.connect_same_thread (*this, boost::bind (&SessionHandleRef::insanity_check, this));
}
void
SessionHandleRef::session_going_away ()
{
- error << string_compose (_("programming error: %1"), "SessionHandleRef exists across sesssion deletion!") << endmsg;
+ /* a handleRef is allowed to exist at the time of DropReferences, but not at the time of Destroyed
+ */
+}
+
+void
+SessionHandleRef::insanity_check ()
+{
+ cerr << string_compose (_("programming error: %1"), "SessionHandleRef exists across sesssion deletion!") << endl;
}
diff --git a/libs/ardour/session_playlists.cc b/libs/ardour/session_playlists.cc
index 238bd72404..17ed6a4e30 100644
--- a/libs/ardour/session_playlists.cc
+++ b/libs/ardour/session_playlists.cc
@@ -43,6 +43,7 @@ SessionPlaylists::~SessionPlaylists ()
++tmp;
DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for used playlist %1 ; pre-ref = %2\n", (*i)->name(), (*i).use_count()));
+ boost::shared_ptr<Playlist> keeper (*i);
(*i)->drop_references ();
i = tmp;
@@ -56,6 +57,7 @@ SessionPlaylists::~SessionPlaylists ()
++tmp;
DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for unused playlist %1 ; pre-ref = %2\n", (*i)->name(), (*i).use_count()));
+ boost::shared_ptr<Playlist> keeper (*i);
(*i)->drop_references ();
i = tmp;
@@ -291,6 +293,7 @@ SessionPlaylists::maybe_delete_unused (boost::function<int(boost::shared_ptr<Pla
/* now delete any that were marked for deletion */
for (vector<boost::shared_ptr<Playlist> >::iterator x = playlists_tbd.begin(); x != playlists_tbd.end(); ++x) {
+ boost::shared_ptr<Playlist> keeper (*x);
(*x)->drop_references ();
}
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 2248663478..1742feaab1 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -274,7 +274,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
SourceFactory::SourceCreated.connect_same_thread (*this, boost::bind (&Session::add_source, this, _1));
PlaylistFactory::PlaylistCreated.connect_same_thread (*this, boost::bind (&Session::add_playlist, this, _1, _2));
Processor::ProcessorCreated.connect_same_thread (*this, boost::bind (&Session::add_processor, this, _1));
- NamedSelection::NamedSelectionCreated.connect_same_thread (*this, boost::bind (&Session::add_named_selection, this, _1));
AutomationList::AutomationListCreated.connect_same_thread (*this, boost::bind (&Session::add_automation_list, this, _1));
Controllable::Destroyed.connect_same_thread (*this, boost::bind (&Session::remove_controllable, this, _1));
IO::PortCountChanged.connect_same_thread (*this, boost::bind (&Session::ensure_buffers, this, _1));
@@ -789,7 +788,7 @@ Session::load_state (string snapshot_name)
/* there is pending state from a crashed capture attempt */
- if (AskAboutPendingState()) {
+ if (*AskAboutPendingState()) {
state_was_pending = true;
}
}
@@ -1126,7 +1125,7 @@ Session::set_state (const XMLNode& node, int version)
_nominal_frame_rate = atoi (prop->value());
if (_nominal_frame_rate != _current_frame_rate) {
- if (AskAboutSampleRateMismatch (_nominal_frame_rate, _current_frame_rate)) {
+ if (*AskAboutSampleRateMismatch (_nominal_frame_rate, _current_frame_rate)) {
return -1;
}
}
diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc
index 185cb15e79..d9d428a4cb 100644
--- a/libs/ardour/sndfilesource.cc
+++ b/libs/ardour/sndfilesource.cc
@@ -246,8 +246,6 @@ SndFileSource::open ()
SndFileSource::~SndFileSource ()
{
- drop_references ();
-
if (sf) {
sf_close (sf);
sf = 0;
diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc
index ee3ebd2ee3..80631ac840 100644
--- a/libs/ardour/vst_plugin.cc
+++ b/libs/ardour/vst_plugin.cc
@@ -102,7 +102,6 @@ VSTPlugin::VSTPlugin (const VSTPlugin &other)
VSTPlugin::~VSTPlugin ()
{
deactivate ();
- drop_references ();
fst_close (_fst);
}