From 92ab1124809b247707515b7fb03b8c37326fd57c Mon Sep 17 00:00:00 2001 From: Hans Fugal Date: Sat, 12 Aug 2006 23:19:56 +0000 Subject: Remove -x from ardbg, fix bug in memento command factory git-svn-id: svn://localhost/ardour2/branches/undo@814 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/session_command.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'libs/ardour/session_command.cc') diff --git a/libs/ardour/session_command.cc b/libs/ardour/session_command.cc index 8c1a4b32cf..dbe0ffccdd 100644 --- a/libs/ardour/session_command.cc +++ b/libs/ardour/session_command.cc @@ -24,6 +24,7 @@ Command *Session::memento_command_factory(XMLNode *n) { PBD::ID id; XMLNode *before = 0, *after = 0; + XMLNode *child; /* get id */ id = PBD::ID(n->property("obj_id")->value()); @@ -33,10 +34,23 @@ Command *Session::memento_command_factory(XMLNode *n) { before = new XMLNode(*n->children().front()); after = new XMLNode(*n->children().back()); + child = before; } else if (n->name() == "MementoUndoCommand") + { before = new XMLNode(*n->children().front()); + child = before; + } else if (n->name() == "MementoRedoCommand") + { after = new XMLNode(*n->children().front()); + child = after; + } + + if (!child) + { + error << _("Tried to reconstitute a MementoCommand with no contents, failing. id=") << id.to_s() << endmsg; + return 0; + } /* create command */ @@ -59,7 +73,7 @@ Command *Session::memento_command_factory(XMLNode *n) return new MementoCommand(*_tempo_map, before, after); else if (obj_T == "Playlist" || obj_T == "AudioPlaylist") { - if (Playlist *pl = playlist_by_name(before->property("name")->value())) + if (Playlist *pl = playlist_by_name(child->property("name")->value())) return new MementoCommand(*pl, before, after); } else if (obj_T == "Route") // inlcudes AudioTrack -- cgit v1.2.3