summaryrefslogtreecommitdiff
path: root/libs/ardour/session_command.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-02-09 22:45:13 +0000
committerCarl Hetherington <carl@carlh.net>2010-02-09 22:45:13 +0000
commitc9d433d9b3f166e761bfc1b4765cc51b0a521e7d (patch)
tree4f17bd9ee84d78662850180ec11cf658a367e556 /libs/ardour/session_command.cc
parent12b9571b8007238a365324238e42721ab994853f (diff)
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
Diffstat (limited to 'libs/ardour/session_command.cc')
-rw-r--r--libs/ardour/session_command.cc13
1 files changed, 9 insertions, 4 deletions
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<Region>(*regions[id], before, after);
+ boost::shared_ptr<Region> r = RegionFactory::region_by_id (id);
+ if (r) {
+ return new MementoCommand<Region>(*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<Region> r = RegionFactory::region_by_id (id);
+ if (r) {
+ return new StatefulDiffCommand (r.get(), *n);
+ }
}
/* we failed */