diff options
author | Robin Gareus <robin@gareus.org> | 2016-05-07 17:16:59 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-05-07 17:16:59 +0200 |
commit | e59ab55831f6daed1eb7a299120787182b9416b7 (patch) | |
tree | 4d71d62decdae9f0d6669e2cd5ed4c694a910c93 /libs/ardour/session_transport.cc | |
parent | 2066afe28c9708b8739918f82d26a732684ea4a3 (diff) |
a few strategic LocaleGuards..
..to prevent switching forth and back during individual
::state(), ::set_state() when loading/saving the session or locating.
Diffstat (limited to 'libs/ardour/session_transport.cc')
-rw-r--r-- | libs/ardour/session_transport.cc | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index f1486ada78..47e0baaf5f 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -373,6 +373,12 @@ Session::butler_transport_work () } if (ptw & PostTransportAdjustPlaybackBuffering) { + /* non_realtime_locate() calls Automatable::transport_located() + * for every route. This eventually calls + * ARDOUR::AutomationList::state () which has a LocaleGuard, + * and would switch locales forth/back every time. + */ + LocaleGuard lg; for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i); if (tr) { @@ -421,7 +427,7 @@ Session::butler_transport_work () /* don't seek if locate will take care of that in non_realtime_stop() */ if (!(ptw & PostTransportLocate)) { - + LocaleGuard lg; // see note for non_realtime_locate() above for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { (*i)->non_realtime_locate (_transport_frame); @@ -530,9 +536,12 @@ Session::non_realtime_locate () } - boost::shared_ptr<RouteList> rl = routes.reader(); - for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { - (*i)->non_realtime_locate (_transport_frame); + { + LocaleGuard lg; // see note for non_realtime_locate() above + boost::shared_ptr<RouteList> rl = routes.reader(); + for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { + (*i)->non_realtime_locate (_transport_frame); + } } _scene_changer->locate (_transport_frame); @@ -789,15 +798,18 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) /* this for() block can be put inside the previous if() and has the effect of ... ??? what */ - DEBUG_TRACE (DEBUG::Transport, X_("Butler PTW: locate\n")); - for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - DEBUG_TRACE (DEBUG::Transport, string_compose ("Butler PTW: locate on %1\n", (*i)->name())); - (*i)->non_realtime_locate (_transport_frame); + { + LocaleGuard lg; // see note for non_realtime_locate() above + DEBUG_TRACE (DEBUG::Transport, X_("Butler PTW: locate\n")); + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + DEBUG_TRACE (DEBUG::Transport, string_compose ("Butler PTW: locate on %1\n", (*i)->name())); + (*i)->non_realtime_locate (_transport_frame); - if (on_entry != g_atomic_int_get (&_butler->should_do_transport_work)) { - finished = false; - /* we will be back */ - return; + if (on_entry != g_atomic_int_get (&_butler->should_do_transport_work)) { + finished = false; + /* we will be back */ + return; + } } } |