#include "ardour/butler.h"
#include "ardour/configuration.h"
#include "ardour/cycle_timer.h"
+#include "ardour/debug.h"
#include "ardour/io.h"
#include "ardour/playlist_factory.h"
#include "ardour/region_factory.h"
AudioDiskstream::~AudioDiskstream ()
{
- cerr << "AD going away\n";
+ DEBUG_TRACE (DEBUG::Destruction, string_compose ("Audio Diskstream %1 destructor\n", _name));
notify_callbacks ();
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;
OverlapType c = top->coverage (bottom->position(), bottom->last_frame());
+ delete touched_regions;
+
try {
switch (c) {
case OverlapNone:
}
}
+
+ delete touched_regions;
}
void
#include <glibmm/thread.h>
#include "ardour/audiofilesource.h"
+#include "ardour/debug.h"
#include "ardour/sndfile_helpers.h"
#include "ardour/sndfilesource.h"
#include "ardour/session.h"
if (init (path, true)) {
throw failed_constructor ();
}
- cerr << "AFS1 created, " << path << endl;
}
/** Constructor used for new internal-to-session files. */
if (init (path, false)) {
throw failed_constructor ();
}
- cerr << "AFS2 created, " << path << endl;
}
/** Constructor used for existing internal-to-session files. File must exist. */
if (init (_name, must_exist)) {
throw failed_constructor ();
}
- cerr << "AFS3 created, " << path() << endl;
}
AudioFileSource::~AudioFileSource ()
{
- cerr << "AFS " << _name << " destructor, path = " << path() << endl;
+ DEBUG_TRACE (DEBUG::Destruction, string_compose ("AudioFileSource destructor %1, removable? %2\n", _path, removable()));
if (removable()) {
- cerr << "\tremoving file\n";
unlink (_path.c_str());
unlink (peakpath.c_str());
}
Diskstream::~Diskstream ()
{
- if (_playlist)
- _playlist->release ();
DEBUG_TRACE (DEBUG::Destruction, string_compose ("Diskstream %1 deleted\n", _name));
+
+ if (_playlist) {
+ _playlist->release ();
+ }
}
void
#include "pbd/xml++.h"
#include "pbd/stacktrace.h"
+#include "ardour/debug.h"
#include "ardour/playlist.h"
#include "ardour/session.h"
#include "ardour/region.h"
Playlist::~Playlist ()
{
+ DEBUG_TRACE (DEBUG::Destruction, string_compose ("Playlist %1 destructor\n", _name));
{
RegionLock rl (this);
Region::~Region ()
{
+ DEBUG_TRACE (DEBUG::Destruction, string_compose ("Region %1 destructor @ %2\n", _name, this));
notify_callbacks ();
GoingAway (); /* EMIT SIGNAL */
- DEBUG_TRACE (DEBUG::Destruction, string_compose ("Region %1 deleted\n", _name));
}
void
*/
#include "pbd/error.h"
+#include "pbd/boost_debug.h"
#include "ardour/session.h"
if ((other_a = boost::dynamic_pointer_cast<AudioRegion>(region)) != 0) {
AudioRegion* ar = new AudioRegion (other_a, start, length, name, layer, flags);
+ boost_debug_shared_ptr_mark_interesting (ar, typeid (ar).name());
boost::shared_ptr<AudioRegion> arp (ar);
boost::shared_ptr<Region> ret (boost::static_pointer_cast<Region> (arp));
ret->unlock_property_changes ();
boost::shared_ptr<const MidiRegion> mr;
if ((ar = boost::dynamic_pointer_cast<const AudioRegion>(region)) != 0) {
- boost::shared_ptr<Region> ret (new AudioRegion (ar));
+ AudioRegion* arn = new AudioRegion (ar);
+ boost_debug_shared_ptr_mark_interesting (arn, typeid (arn).name());
+ boost::shared_ptr<Region> ret (arn);
ret->unlock_property_changes ();
/* pure copy constructor - no CheckNewRegion emitted */
return ret;
if ((other = boost::dynamic_pointer_cast<AudioRegion>(region)) != 0) {
AudioRegion* ar = new AudioRegion (other, srcs, srcs.front()->length(srcs.front()->timeline_position()), name, layer, flags);
+ boost_debug_shared_ptr_mark_interesting (ar, typeid (ar).name());
boost::shared_ptr<AudioRegion> arp (ar);
boost::shared_ptr<Region> ret (boost::static_pointer_cast<Region> (arp));
ret->unlock_property_changes ();
if (srcs[0]->type() == DataType::AUDIO) {
AudioRegion* ar = new AudioRegion (srcs, start, length, name, layer, flags);
+ boost_debug_shared_ptr_mark_interesting (ar, typeid (ar).name());
boost::shared_ptr<AudioRegion> arp (ar);
boost::shared_ptr<Region> ret (boost::static_pointer_cast<Region> (arp));
ret->unlock_property_changes ();
}
if (srcs[0]->type() == DataType::AUDIO) {
- boost::shared_ptr<Region> ret (new AudioRegion (srcs, node));
+ AudioRegion* ar = new AudioRegion (srcs, node);
+ boost_debug_shared_ptr_mark_interesting (ar, typeid (ar).name());
+ boost::shared_ptr<Region> ret (ar);
ret->unlock_property_changes ();
CheckNewRegion (ret);
return ret;
boost::shared_ptr<MidiSource> ms;
if ((as = boost::dynamic_pointer_cast<AudioSource>(src)) != 0) {
- boost::shared_ptr<Region> ret (new AudioRegion (as, start, length, name, layer, flags));
+ AudioRegion* ar = new AudioRegion (as, start, length, name, layer, flags);
+ boost_debug_shared_ptr_mark_interesting (ar, typeid (ar).name());
+ boost::shared_ptr<Region> ret (ar);
ret->unlock_property_changes ();
if (announce) {
CheckNewRegion (ret);
Route::~Route ()
{
+ DEBUG_TRACE (DEBUG::Destruction, string_compose ("route %1 destructor\n", _name));
Metering::disconnect (_meter_connection);
/* don't use clear_processors here, as it depends on the session which may
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
(*i)->drop_references ();
}
+
_processors.clear ();
}
i = tmp;
}
- DEBUG_TRACE (DEBUG::Destruction, "delete playlists\n");
+ DEBUG_TRACE (DEBUG::Destruction, "delete used playlists\n");
for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ) {
PlaylistList::iterator tmp;
DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for used playlist %1 ; pre-ref = %2\n", (*i)->name(), (*i).use_count()));
(*i)->drop_references ();
- DEBUG_TRACE(DEBUG::Destruction, string_compose ("post-ref = %1\n", (*i).use_count()));
+
i = tmp;
}
+ DEBUG_TRACE (DEBUG::Destruction, "delete unused playlists\n");
for (PlaylistList::iterator i = unused_playlists.begin(); i != unused_playlists.end(); ) {
PlaylistList::iterator tmp;
DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for unused playlist %1 ; pre-ref = %2\n", (*i)->name(), (*i).use_count()));
(*i)->drop_references ();
- DEBUG_TRACE(DEBUG::Destruction, string_compose ("post-ref = %2\n", (*i).use_count()));
i = tmp;
}
tmp = i;
++tmp;
- DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for region %1 ; pre-ref = %2\n", i->second->name(), i->second.use_count()));
+ DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for region %1 (%2); pre-ref = %2\n", i->second->name(), i->second.get(), i->second.use_count()));
i->second->drop_references ();
- DEBUG_TRACE(DEBUG::Destruction, string_compose ("\tpost-ref%2\n", i->second.use_count()));
-
+ 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");
+
+ /* reset these three references to special routes before we do the usual route delete thing */
+
+ auditioner.reset ();
+ _master_out.reset ();
+ _control_out.reset ();
+
{
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 ();
- DEBUG_TRACE(DEBUG::Destruction, string_compose ("post-ref = %1\n", (*i).use_count()));
- debug_pointers.push_back ((*i).get());
}
r->clear ();
/* writer goes out of scope and updates master */
for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for diskstream %1 ; pre-ref = %2\n", (*i)->name(), (*i).use_count()));
(*i)->drop_references ();
- DEBUG_TRACE(DEBUG::Destruction, string_compose ("post-ref = %1\n", (*i).use_count()));
}
dsl->clear ();
}
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 ();
- DEBUG_TRACE(DEBUG::Destruction, string_compose ("\tpost-ref%1\n", i->second.use_count()));
i = tmp;
}
- cerr << "Pre source clear, we have " << sources.size() << endl;
+
sources.clear ();
- cerr << "Post source clear, we have " << sources.size() << endl;
+
DEBUG_TRACE (DEBUG::Destruction, "delete route groups\n");
for (list<RouteGroup *>::iterator i = _route_groups.begin(); i != _route_groups.end(); ++i) {
delete mmc;
boost_debug_list_ptrs ();
+
+ DEBUG_TRACE (DEBUG::Destruction, "Session::destroy() done\n");
}
void
for (i = r->begin(); i != r->end(); ++i) {
- cerr << "\n\n\n CLEAR FED BY for " << (*i)->name() << endl;
-
(*i)->fed_by.clear ();
for (j = r->begin(); j != r->end(); ++j) {
try {
AudioTrack* at = new AudioTrack (*this, track_name, Route::Flag (0), mode);
- boost_debug_shared_ptr_mark_interesting (at, typeid (at).name());
+ // boost_debug_shared_ptr_mark_interesting (at, typeid (at).name());
track = boost::shared_ptr<AudioTrack>(at);
if (track->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) {
Session::graph_reordered ()
{
/* don't do this stuff if we are setting up connections
- from a set_state() call or creating new tracks.
+ from a set_state() call or creating new tracks. Ditto for deletion.
*/
- if (_state_of_the_state & InitialConnecting) {
+ if (_state_of_the_state & (InitialConnecting|Deletion)) {
return;
}
if (has_diskstream) {
if (type == DataType::AUDIO) {
AudioTrack* at = new AudioTrack (*this, node, version);
- boost_debug_shared_ptr_mark_interesting (at, typeid (at).name());
+ // boost_debug_shared_ptr_mark_interesting (at, typeid (at).name());
boost::shared_ptr<Route> ret (at);
return ret;
} else {
Source::~Source ()
{
+ DEBUG_TRACE (DEBUG::Destruction, string_compose ("Source %1 destructor\n", _name));
notify_callbacks ();
- DEBUG_TRACE (DEBUG::Destruction, string_compose ("Source %1 deleted\n", _name));
}
#include "ardour/audioplaylist.h"
#include "ardour/audioregion.h"
#include "ardour/audiosource.h"
+#include "ardour/debug.h"
#include "ardour/delivery.h"
#include "ardour/diskstream.h"
#include "ardour/io_processor.h"
Track::~Track ()
{
+ DEBUG_TRACE (DEBUG::Destruction, string_compose ("track %1 destructor\n", _name));
}
void
Glib::Mutex::Lock guard (the_lock);
pair<void*,const char*> newpair (ptr, type);
interesting_pointers.insert (newpair);
+ // cerr << "Interesting object @ " << ptr << " of type " << type << endl;
}
void
if (x != sptrs.end()) {
sptrs.erase (x);
+ // cerr << "Removed sp for " << obj << " @ " << sp << endl;
}
}
+
void
boost_debug_shared_ptr_constructor (void const *sp, void const *obj, int use_count)
{
-
if (is_interesting_object (obj)) {
Glib::Mutex::Lock guard (the_lock);
pair<void const*, SPDebug*> newpair;
newpair.second = new SPDebug (new Backtrace());
sptrs.insert (newpair);
+ // cerr << "Stored constructor for " << obj << " @ " << sp << endl;
}
}
boost_debug_list_ptrs ()
{
Glib::Mutex::Lock guard (the_lock);
- for (PointerMap::iterator x = sptrs.begin(); x != sptrs.end(); ++x) {
- cerr << "Shared ptr @ " << x->first << " history: "
- << *x->second
- << endl;
+
+ if (sptrs.empty()) {
+ cerr << "There are no dangling shared ptrs\n";
+ } else {
+ for (PointerMap::iterator x = sptrs.begin(); x != sptrs.end(); ++x) {
+ cerr << "Shared ptr @ " << x->first << " history: "
+ << *x->second
+ << endl;
+ }
}
}