From c9d433d9b3f166e761bfc1b4765cc51b0a521e7d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 9 Feb 2010 22:45:13 +0000 Subject: Make the MementoCommand and StatefulDiffCommand factories look up region IDs in the RegionFactory's map, so that they find the ones they are looking for. git-svn-id: svn://localhost/ardour2/branches/3.0@6670 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/session_command.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'libs/ardour/session_command.cc') diff --git a/libs/ardour/session_command.cc b/libs/ardour/session_command.cc index 897359b274..82ecc60b83 100644 --- a/libs/ardour/session_command.cc +++ b/libs/ardour/session_command.cc @@ -32,6 +32,7 @@ #include "ardour/midi_source.h" #include "ardour/midi_region.h" #include "ardour/session_playlists.h" +#include "ardour/region_factory.h" #include "pbd/error.h" #include "pbd/id.h" #include "pbd/statefuldestructible.h" @@ -86,8 +87,9 @@ Session::memento_command_factory(XMLNode *n) string obj_T = n->property ("type-name")->value(); if (obj_T == typeid (AudioRegion).name() || obj_T == typeid (MidiRegion).name() || obj_T == typeid (Region).name()) { - if (regions.count(id)) { - return new MementoCommand(*regions[id], before, after); + boost::shared_ptr r = RegionFactory::region_by_id (id); + if (r) { + return new MementoCommand(*r, before, after); } } else if (obj_T == typeid (AudioSource).name() || obj_T == typeid (MidiSource).name()) { @@ -139,8 +141,11 @@ Session::stateful_diff_command_factory (XMLNode* n) PBD::ID const id (n->property("obj-id")->value ()); string const obj_T = n->property ("type-name")->value (); - if ((obj_T == typeid (AudioRegion).name() || obj_T == typeid (MidiRegion).name()) && regions.count(id)) { - return new StatefulDiffCommand (regions[id].get(), *n); + if ((obj_T == typeid (AudioRegion).name() || obj_T == typeid (MidiRegion).name())) { + boost::shared_ptr r = RegionFactory::region_by_id (id); + if (r) { + return new StatefulDiffCommand (r.get(), *n); + } } /* we failed */ -- cgit v1.2.3