summaryrefslogtreecommitdiff
path: root/libs/ardour/source_factory.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-12-09 21:34:31 +0000
committerCarl Hetherington <carl@carlh.net>2010-12-09 21:34:31 +0000
commit7d4e03e28e58a9315f163738f35559f57b099d37 (patch)
tree37b39ea5e40835a918a77845b01fb4ab1515ba66 /libs/ardour/source_factory.cc
parentebf3762fa91d911af411f1b5c68e3c67f2c47170 (diff)
Use a weak_ptr rather than a bald pointer for _midi_source in MidiModel.
git-svn-id: svn://localhost/ardour2/branches/3.0@8228 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/source_factory.cc')
-rw-r--r--libs/ardour/source_factory.cc21
1 files changed, 11 insertions, 10 deletions
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc
index f886f952bd..b7c4a8ff56 100644
--- a/libs/ardour/source_factory.cc
+++ b/libs/ardour/source_factory.cc
@@ -178,12 +178,12 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
}
} else if (type == DataType::MIDI) {
- Source* src = new SMFSource (s, node);
+ boost::shared_ptr<SMFSource> src (new SMFSource (s, node));
+ src->load_model (true, true);
// boost_debug_shared_ptr_mark_interesting (src, "Source");
- boost::shared_ptr<Source> ret (src);
- ret->check_for_analysis_data_on_disk ();
- SourceCreated (ret);
- return ret;
+ src->check_for_analysis_data_on_disk ();
+ SourceCreated (src);
+ return src;
}
return boost::shared_ptr<Source>();
@@ -240,7 +240,8 @@ SourceFactory::createReadable (DataType type, Session& s, const string& path,
} else if (type == DataType::MIDI) {
- Source* src = new SMFSource (s, path, SMFSource::Flag(0));
+ SMFSource* src = new SMFSource (s, path, SMFSource::Flag(0));
+ src->load_model (true, true);
// boost_debug_shared_ptr_mark_interesting (src, "Source");
boost::shared_ptr<Source> ret (src);
@@ -285,16 +286,16 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat
} else if (type == DataType::MIDI) {
// XXX writable flags should belong to MidiSource too
- Source* src = new SMFSource (s, path, SndFileSource::default_writable_flags);
+ boost::shared_ptr<SMFSource> src (new SMFSource (s, path, SndFileSource::default_writable_flags));
+ src->load_model (true, true);
// boost_debug_shared_ptr_mark_interesting (src, "Source");
- boost::shared_ptr<Source> ret (src);
// no analysis data - this is a new file
if (announce) {
- SourceCreated (ret);
+ SourceCreated (src);
}
- return ret;
+ return src;
}