From 08a1409b1f5b5558d2eccc28a3ae4cbd44391812 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 29 May 2014 16:28:57 -0400 Subject: [PATCH] back port 6576105 from cairocanvas as fix for data loss/file deletion --- gtk2_ardour/editor_audio_import.cc | 2 +- libs/ardour/ardour/session.h | 4 ++-- libs/ardour/import.cc | 2 +- libs/ardour/session.cc | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index a19a62b337..9364437b78 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -611,7 +611,7 @@ Editor::embed_sndfiles (vector paths, bool multifile, boost::shared_ptr s; - if ((s = _session->source_by_path_and_channel (path, n)) == 0) { + if ((s = _session->audio_source_by_path_and_channel (path, n)) == 0) { source = boost::dynamic_pointer_cast ( SourceFactory::createExternal (DataType::AUDIO, *_session, diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 38185a71d6..168137ffc3 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -584,8 +584,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi boost::shared_ptr create_midi_source_by_stealing_name (boost::shared_ptr); boost::shared_ptr source_by_id (const PBD::ID&); - boost::shared_ptr source_by_path_and_channel (const std::string&, uint16_t) const; - boost::shared_ptr source_by_path (const std::string&) const; + boost::shared_ptr audio_source_by_path_and_channel (const std::string&, uint16_t) const; + boost::shared_ptr midi_source_by_path (const std::string&) const; uint32_t count_sources_by_origin (const std::string&); void add_playlist (boost::shared_ptr, bool unused = false); diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index 047b46f553..e63143e695 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -201,7 +201,7 @@ map_existing_mono_sources (const vector& new_paths, Session& /*sess*/, for (vector::const_iterator i = new_paths.begin(); i != new_paths.end(); ++i) { - boost::shared_ptr source = session->source_by_path_and_channel(*i, 0); + boost::shared_ptr source = session->audio_source_by_path_and_channel(*i, 0); if (source == 0) { error << string_compose(_("Could not find a source for %1 even though we are updating this file!"), (*i)) << endl; diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 1de5730a95..1006c0f90b 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -3305,7 +3305,7 @@ Session::source_by_id (const PBD::ID& id) } boost::shared_ptr -Session::source_by_path_and_channel (const string& path, uint16_t chn) const +Session::audio_source_by_path_and_channel (const string& path, uint16_t chn) const { /* Restricted to audio files because only audio sources have channel as a property. @@ -3326,7 +3326,7 @@ Session::source_by_path_and_channel (const string& path, uint16_t chn) const } boost::shared_ptr -Session::source_by_path (const std::string& path) const +Session::midi_source_by_path (const std::string& path) const { /* Restricted to MIDI files because audio sources require a channel for unique identification, in addition to a path. @@ -3481,7 +3481,7 @@ Session::new_audio_source_name (const string& base, uint32_t nchan, uint32_t cha string possible_path = Glib::build_filename (spath, buf); - if (source_by_path (possible_path)) { + if (audio_source_by_path_and_channel (possible_path, chan)) { existing++; break; } @@ -3547,7 +3547,7 @@ Session::new_midi_source_name (const string& owner_name) existing++; } - if (source_by_path (possible_path)) { + if (midi_source_by_path (possible_path)) { existing++; } }