diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-04-06 02:27:24 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-04-06 02:27:24 +0000 |
commit | 8ed825c3dddbd0feaf30ef1311dac30454ac5cdd (patch) | |
tree | 106031abb005110218ceafc135adca98f0089c5b /libs | |
parent | d4a73c373a5447ed777b62206159e57a2cc88607 (diff) |
fix nasty logic error that leads to crashing bugs when trying to operate on regions that have been subject to undo/redo
git-svn-id: svn://localhost/ardour2/trunk@1670 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/playlist.h | 1 | ||||
-rw-r--r-- | libs/ardour/audiofilesource.cc | 29 | ||||
-rw-r--r-- | libs/ardour/playlist.cc | 10 | ||||
-rw-r--r-- | libs/ardour/session_time.cc | 1 | ||||
-rw-r--r-- | libs/pbd/SConscript | 1 |
5 files changed, 37 insertions, 5 deletions
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 103e95929e..5f33719ae7 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -182,6 +182,7 @@ class Playlist : public PBD::StatefulDestructible, public boost::enable_shared_f bool save_on_thaw; string last_save_reason; uint32_t in_set_state; + bool first_set_state; bool _hidden; bool _splicing; bool _nudging; diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index 9a3bf266ae..929cfc8083 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -29,11 +29,13 @@ #include <pbd/pathscanner.h> #include <pbd/stl_delete.h> #include <pbd/strsplit.h> +#include <pbd/shortpath.h> #include <pbd/enumwriter.h> #include <sndfile.h> #include <glibmm/miscutils.h> +#include <glibmm/fileutils.h> #include <ardour/audiofilesource.h> #include <ardour/sndfile_helpers.h> @@ -366,10 +368,33 @@ AudioFileSource::find (ustring& pathstr, bool must_exist, bool& isnew) isnew = false; - /* clean up PATH:CHANNEL notation so that we are looking for the correct path */ + /* i (paul) made a nasty design error by using ':' as a special character in + Ardour 0.99 .. this hack tries to make things sort of work. + */ if ((pos = pathstr.find_last_of (':')) != ustring::npos) { - pathstr = pathstr.substr (0, pos); + if (Glib::file_test (pathstr, Glib::FILE_TEST_EXISTS)) { + /* its a real file, no problem */ + + } else { + + if (must_exist) { + + /* older session using file:channel syntax */ + + warning << string_compose (_("This older session references an embedded\n\ +non-mono audio file:\n\n%1\n\n \ +The session file may be edited or the file must be removed before it can be used."), + short_path (pathstr, 48)) + << endmsg; + return false; + + } else { + + /* new derived file (e.g. for timefx) being created in a newer session */ + + } + } } if (pathstr[0] != '/') { diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index ae9e23fcc9..807bcd23ca 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -74,6 +74,7 @@ Playlist::Playlist (Session& sess, string nom, bool hide) : _session (sess) { init (hide); + first_set_state = false; _name = nom; } @@ -108,6 +109,7 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, string namestr, boo _edit_mode = other->_edit_mode; in_set_state = 0; + first_set_state = false; in_flush = false; in_partition = false; subcnt = 0; @@ -180,6 +182,7 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, nframes_t start, nf } in_set_state--; + first_set_state = false; /* this constructor does NOT notify others (session) */ } @@ -220,6 +223,7 @@ Playlist::init (bool hide) g_atomic_int_set (&ignore_state_changes, 0); pending_modified = false; pending_length = false; + first_set_state = true; _refcnt = 0; _hidden = hide; _splicing = false; @@ -508,10 +512,10 @@ Playlist::add_region_internal (boost::shared_ptr<Region> region, nframes_t posit old_length = _get_maximum_extent(); } - if (!in_set_state) { + if (!first_set_state) { boost::shared_ptr<Playlist> foo (shared_from_this()); region->set_playlist (boost::weak_ptr<Playlist>(foo)); - } + } region->set_position (position, this); @@ -1418,7 +1422,7 @@ Playlist::set_state (const XMLNode& node) } in_set_state--; - + first_set_state = false; return 0; } diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc index 2a921c3dc9..9ae3492ea7 100644 --- a/libs/ardour/session_time.cc +++ b/libs/ardour/session_time.cc @@ -25,6 +25,7 @@ #include <ardour/timestamps.h> #include <pbd/error.h> +#include <pbd/enumwriter.h> #include <pbd/stacktrace.h> #include <ardour/ardour.h> diff --git a/libs/pbd/SConscript b/libs/pbd/SConscript index 12664a1fca..3aaeb1bf1b 100644 --- a/libs/pbd/SConscript +++ b/libs/pbd/SConscript @@ -34,6 +34,7 @@ pathscanner.cc pool.cc pthread_utils.cc receiver.cc +shortpath.cc stacktrace.cc stateful.cc strreplace.cc |