13
0

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
This commit is contained in:
Paul Davis 2006-10-21 05:12:11 +00:00
parent 273d9fa8d6
commit fbb9576d40
11 changed files with 64 additions and 24 deletions

View File

@ -1691,7 +1691,7 @@ Editor::add_region_context_items (AudioStreamView* sv, boost::shared_ptr<Region>
become selected.
*/
region_menu->signal_map_event().connect (bind (mem_fun(*this, &Editor::set_selected_regionview_from_map_event), sv, region));
region_menu->signal_map_event().connect (bind (mem_fun(*this, &Editor::set_selected_regionview_from_map_event), sv, boost::weak_ptr<Region>(region)));
items.push_back (MenuElem (_("Popup region editor"), mem_fun(*this, &Editor::edit_region)));
items.push_back (MenuElem (_("Raise to top layer"), mem_fun(*this, &Editor::raise_region_to_top)));
@ -3198,9 +3198,15 @@ Editor::set_selected_regionview_from_region_list (boost::shared_ptr<Region> regi
}
bool
Editor::set_selected_regionview_from_map_event (GdkEventAny* ev, StreamView* sv, boost::shared_ptr<Region> r)
Editor::set_selected_regionview_from_map_event (GdkEventAny* ev, StreamView* sv, boost::weak_ptr<Region> weak_r)
{
RegionView* rv;
boost::shared_ptr<Region> r (weak_r.lock());
if (!r) {
return true;
}
boost::shared_ptr<AudioRegion> ar;
if ((ar = boost::dynamic_pointer_cast<AudioRegion> (r)) == 0) {
@ -3524,15 +3530,15 @@ Editor::zoom_focus_selection_done ()
string choice = zoom_focus_selector.get_active_text();
ZoomFocus focus_type = ZoomFocusLeft;
if (choice == _("Focus Left")) {
if (choice == _("Left")) {
focus_type = ZoomFocusLeft;
} else if (choice == _("Focus Right")) {
} else if (choice == _("Right")) {
focus_type = ZoomFocusRight;
} else if (choice == _("Focus Center")) {
} else if (choice == _("Center")) {
focus_type = ZoomFocusCenter;
} else if (choice == _("Focus Playhead")) {
} else if (choice == _("Playhead")) {
focus_type = ZoomFocusPlayhead;
} else if (choice == _("Focus Edit Cursor")) {
} else if (choice == _("Edit Cursor")) {
focus_type = ZoomFocusEdit;
}

View File

@ -441,7 +441,7 @@ class Editor : public PublicEditor
bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::shared_ptr<ARDOUR::Region>);
bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
void collect_new_region_view (RegionView *);
Gtk::Menu track_context_menu;

View File

@ -3340,7 +3340,7 @@ Editor::normalize_region ()
continue;
XMLNode &before = arv->region()->get_state();
arv->audio_region()->normalize_to (0.0f);
session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
// session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
}
commit_reversible_command ();

View File

@ -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;

View File

@ -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;
}

View File

@ -306,6 +306,7 @@ AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node)
AudioRegion::~AudioRegion ()
{
cerr << "====== " << _name << " DESTRUCTOR @ " << this << endl;
notify_callbacks ();
GoingAway (); /* EMIT SIGNAL */
}

View File

@ -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

View File

@ -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;
}

View File

@ -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 */
}

View File

@ -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;
}

View File

@ -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)));
}