summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-10-21 05:12:11 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-10-21 05:12:11 +0000
commitfbb9576d4047c03276cc2e1b750465c3b0371c6c (patch)
treefb0ed6838c8565a7cdafcd5da63f41d7b87989a8 /libs
parent273d9fa8d6fc7fb0c16f805933040ed5962ff3d5 (diff)
various fixes related to lifetime management and xfades in particular. lots and lots and lots of debugging output, but sampo can test startup now. shutdown will still crash, but for a new reason.
git-svn-id: svn://localhost/ardour2/trunk@998 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/playlist.h2
-rw-r--r--libs/ardour/audio_playlist.cc35
-rw-r--r--libs/ardour/audioregion.cc1
-rw-r--r--libs/ardour/crossfade.cc2
-rw-r--r--libs/ardour/playlist.cc16
-rw-r--r--libs/ardour/region.cc2
-rw-r--r--libs/ardour/session.cc3
-rw-r--r--libs/pbd/pbd/memento_command.h3
8 files changed, 49 insertions, 15 deletions
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index 2d19f661c4..9cc3f86f0b 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -178,7 +178,7 @@ class Playlist : public PBD::StatefulDestructible {
bool pending_length;
bool save_on_thaw;
string last_save_reason;
- bool in_set_state;
+ uint32_t in_set_state;
bool _hidden;
bool _splicing;
bool _nudging;
diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc
index be8680882f..cce6e188f8 100644
--- a/libs/ardour/audio_playlist.cc
+++ b/libs/ardour/audio_playlist.cc
@@ -42,9 +42,9 @@ using namespace PBD;
AudioPlaylist::AudioPlaylist (Session& session, const XMLNode& node, bool hidden)
: Playlist (session, node, hidden)
{
- in_set_state = true;
+ in_set_state++;
set_state (node);
- in_set_state = false;
+ in_set_state--;
if (!hidden) {
PlaylistCreated (this); /* EMIT SIGNAL */
@@ -120,10 +120,24 @@ AudioPlaylist::~AudioPlaylist ()
/* drop connections to signals */
notify_callbacks ();
+
+
+ cerr << "deleting crossfades " << _crossfades.size() << endl;
+
+ for (Crossfades::iterator x = _crossfades.begin(); x != _crossfades.end(); ) {
+ Crossfades::iterator tmp;
+
+ tmp = x;
+ ++tmp;
- for (Crossfades::iterator x = _crossfades.begin(); x != _crossfades.end(); ++x) {
delete *x;
+
+ cerr << _crossfades.size() << " to go\n";
+
+ x = tmp;
}
+
+ cerr << "done\n";
}
struct RegionSortByLayer {
@@ -226,6 +240,10 @@ AudioPlaylist::remove_dependents (boost::shared_ptr<Region> region)
{
Crossfades::iterator i, tmp;
boost::shared_ptr<AudioRegion> r = boost::dynamic_pointer_cast<AudioRegion> (region);
+
+ if (in_set_state) {
+ return;
+ }
if (r == 0) {
fatal << _("programming error: non-audio Region passed to remove_overlap in audio playlist")
@@ -354,6 +372,8 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
return;
}
+ cerr << "Check dependents of " << r->name() << endl;
+
if ((region = boost::dynamic_pointer_cast<AudioRegion> (r)) == 0) {
fatal << _("programming error: non-audio Region tested for overlap in audio playlist")
<< endmsg;
@@ -441,7 +461,10 @@ AudioPlaylist::add_crossfade (Crossfade& xfade)
{
Crossfades::iterator ci;
+ cerr << "adding xfade involving " << xfade.in()->name() << " and " << xfade.out()->name() << endl;
+
for (ci = _crossfades.begin(); ci != _crossfades.end(); ++ci) {
+ cerr << "\tcompare to " << (*ci)->in()->name() << " and " << (*ci)->out()->name() << endl;
if (*(*ci) == xfade) { // Crossfade::operator==()
break;
}
@@ -488,6 +511,9 @@ AudioPlaylist::set_state (const XMLNode& node)
XMLNodeList nlist;
XMLNodeConstIterator niter;
+ in_set_state++;
+ freeze ();
+
Playlist::set_state (node);
nlist = node.children();
@@ -516,6 +542,9 @@ AudioPlaylist::set_state (const XMLNode& node)
}
}
+ thaw ();
+ in_set_state++;
+
return 0;
}
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index d2cf279d3e..2f2c67ec50 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -306,6 +306,7 @@ AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node)
AudioRegion::~AudioRegion ()
{
+ cerr << "====== " << _name << " DESTRUCTOR @ " << this << endl;
notify_callbacks ();
GoingAway (); /* EMIT SIGNAL */
}
diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc
index 50e3ff2905..739ea1cc0e 100644
--- a/libs/ardour/crossfade.cc
+++ b/libs/ardour/crossfade.cc
@@ -197,7 +197,9 @@ Crossfade::Crossfade (const Crossfade &orig, boost::shared_ptr<AudioRegion> newi
Crossfade::~Crossfade ()
{
+ cerr << "Deleting xfade @ " << this << endl;
Invalidated (this);
+ cerr << "invalidation signal sent\n";
}
void
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index ef5fe276bb..87eed692b6 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -99,19 +99,19 @@ Playlist::Playlist (const Playlist& other, string namestr, bool hide)
RegionList tmp;
other.copy_regions (tmp);
- in_set_state = true;
+ in_set_state++;
for (list<boost::shared_ptr<Region> >::iterator x = tmp.begin(); x != tmp.end(); ++x) {
add_region_internal( (*x), (*x)->position() );
}
- in_set_state = false;
+ in_set_state--;
_splicing = other._splicing;
_nudging = other._nudging;
_edit_mode = other._edit_mode;
- in_set_state = false;
+ in_set_state = 0;
in_flush = false;
in_partition = false;
subcnt = 0;
@@ -230,7 +230,7 @@ Playlist::init (bool hide)
_hidden = hide;
_splicing = false;
_nudging = false;
- in_set_state = false;
+ in_set_state = 0;
_edit_mode = Config->get_edit_mode();
in_flush = false;
in_partition = false;
@@ -1321,10 +1321,10 @@ Playlist::set_state (const XMLNode& node)
boost::shared_ptr<Region> region;
string region_name;
- in_set_state = true;
+ in_set_state++;
if (node.name() != "Playlist") {
- in_set_state = false;
+ in_set_state--;
return -1;
}
@@ -1394,10 +1394,10 @@ Playlist::set_state (const XMLNode& node)
notify_modified ();
- in_set_state = false;
-
thaw ();
+ in_set_state--;
+
return 0;
}
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 6e6af0ee11..d49ed933c9 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -144,8 +144,6 @@ Region::Region (const XMLNode& node)
Region::~Region ()
{
- // cerr << "====== " << _name << " DESTRUCTOR\n";
- // stacktrace (cerr);
/* derived classes must call notify_callbacks() and then emit GoingAway */
}
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index e4ff1941e0..66cb1f89fa 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -469,8 +469,9 @@ Session::~Session ()
tmp = i;
++tmp;
- cerr << "dropping refs on an audio region (" << i->second->name() << ") with UC = " << i->second.use_count() << endl;
+ cerr << "dropping refs on an audio region (" << i->second->name() << " @ " << i->second << ") with UC = " << i->second.use_count() << endl;
i->second->drop_references ();
+ cerr << "AFTER: UC = " << i->second.use_count() << endl;
i = tmp;
}
diff --git a/libs/pbd/pbd/memento_command.h b/libs/pbd/pbd/memento_command.h
index 715e9d33e3..d42972d546 100644
--- a/libs/pbd/pbd/memento_command.h
+++ b/libs/pbd/pbd/memento_command.h
@@ -26,6 +26,7 @@ using std::cerr;
using std::endl;
#include <pbd/command.h>
+#include <pbd/stacktrace.h>
#include <pbd/xml++.h>
#include <sigc++/slot.h>
#include <typeinfo>
@@ -36,6 +37,7 @@ using std::endl;
*/
static void object_death (Command* mc) {
+ cerr << "\n\n\n---> OBJECT DEATH FIRED FOR " << mc << endl;
delete mc;
}
@@ -53,6 +55,7 @@ class MementoCommand : public Command
XMLNode *after
)
: obj(object), before(before), after(after) {
+ cerr << "MC @ " << this << " is a " << typeid (obj_T).name() << endl;
obj.GoingAway.connect (sigc::bind (sigc::ptr_fun (object_death), static_cast<Command*>(this)));
}