Don't assume compiler can avoid copy to const ref.

This commit is contained in:
David Robillard
2014-12-18 04:03:39 -05:00
parent e584ae0bf9
commit 7eab4c6f33
3 changed files with 16 additions and 10 deletions

View File

@@ -1771,15 +1771,15 @@ AudioDiskstream::prep_record_enable ()
for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
(*chan)->source.request_input_monitoring (!(_session.config.get_auto_input() && rolling));
capturing_sources.push_back ((*chan)->write_source);
(*chan)->write_source->mark_streaming_write_started (
Source::Lock((*chan)->write_source->mutex()));
Source::Lock lock((*chan)->write_source->mutex());
(*chan)->write_source->mark_streaming_write_started (lock);
}
} else {
for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
capturing_sources.push_back ((*chan)->write_source);
(*chan)->write_source->mark_streaming_write_started (
Source::Lock((*chan)->write_source->mutex()));
Source::Lock lock((*chan)->write_source->mutex());
(*chan)->write_source->mark_streaming_write_started (lock);
}
}
@@ -1965,8 +1965,8 @@ AudioDiskstream::reset_write_sources (bool mark_write_complete, bool /*force*/)
if ((*chan)->write_source) {
if (mark_write_complete) {
(*chan)->write_source->mark_streaming_write_completed (
Source::Lock((*chan)->write_source->mutex()));
Source::Lock lock((*chan)->write_source->mutex());
(*chan)->write_source->mark_streaming_write_completed (lock);
(*chan)->write_source->done_with_peakfile_writes ();
}

View File

@@ -76,7 +76,10 @@ MidiStretch::run (boost::shared_ptr<Region> r, Progress*)
return -1;
boost::shared_ptr<MidiSource> src = region->midi_source(0);
src->load_model(Glib::Threads::Mutex::Lock(src->mutex()));
{
Source::Lock lock(src->mutex());
src->load_model(lock);
}
boost::shared_ptr<MidiModel> old_model = src->model();

View File

@@ -205,7 +205,8 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
}
} else if (type == DataType::MIDI) {
boost::shared_ptr<SMFSource> src (new SMFSource (s, node));
src->load_model (Glib::Threads::Mutex::Lock(src->mutex()), true);
Source::Lock lock(src->mutex());
src->load_model (lock, true);
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
// boost_debug_shared_ptr_mark_interesting (src, "Source");
#endif
@@ -273,7 +274,8 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
} else if (type == DataType::MIDI) {
boost::shared_ptr<SMFSource> src (new SMFSource (s, path));
src->load_model (Glib::Threads::Mutex::Lock(src->mutex()), true);
Source::Lock lock(src->mutex());
src->load_model (lock, true);
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
// boost_debug_shared_ptr_mark_interesting (src, "Source");
#endif
@@ -324,7 +326,8 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat
boost::shared_ptr<SMFSource> src (new SMFSource (s, path, SndFileSource::default_writable_flags));
assert (src->writable ());
src->load_model (Glib::Threads::Mutex::Lock(src->mutex()), true);
Source::Lock lock(src->mutex());
src->load_model (lock, true);
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
// boost_debug_shared_ptr_mark_interesting (src, "Source");
#endif