summaryrefslogtreecommitdiff
path: root/libs/ardour/transport_fsm.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2019-09-20 12:18:49 -0600
committerPaul Davis <paul@linuxaudiosystems.com>2019-09-20 12:26:49 -0600
commitb374eb765880ac868e4bf0e424627db31b5dc26d (patch)
tree5b081369f7dae26bf1687c972c160b155e93579f /libs/ardour/transport_fsm.cc
parent84f8e2302722f27521bab8f9cf999099a6755ff3 (diff)
fix crash when doing rapid (ongoing-locate-interrupting) locates
Diffstat (limited to 'libs/ardour/transport_fsm.cc')
-rw-r--r--libs/ardour/transport_fsm.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/libs/ardour/transport_fsm.cc b/libs/ardour/transport_fsm.cc
index 02faafef9b..7399209d6e 100644
--- a/libs/ardour/transport_fsm.cc
+++ b/libs/ardour/transport_fsm.cc
@@ -348,7 +348,24 @@ void
TransportFSM::interrupt_locate (Event const & l) const
{
assert (l.type == Locate);
- DEBUG_TRACE (DEBUG::TFSMEvents, "tfsm::interrupt\n");
+ DEBUG_TRACE (DEBUG::TFSMEvents, string_compose ("tfsm::interrupt to %1 versus %2\n", l.target, _last_locate.target));
+
+ /* Because of snapping (e.g. of mouse position) we could be
+ * interrupting an existing locate to the same position. If we go ahead
+ * with this, the code in Session::do_locate() will notice that it's a
+ * repeat position, will do nothing, will queue a "locate_done" event
+ * that will arrive in the next process cycle. But this event may be
+ * processed before the original (real) locate has completed in the
+ * butler thread, and processing it may transition us back to Rolling
+ * before some (or even all) tracks are actually ready.
+ *
+ * So, we must avoid this from happening, and this seems like the
+ * simplest way.
+ */
+
+ if (l.target == _last_locate.target && !l.force) {
+ return;
+ }
/* maintain original "with-roll" choice of initial locate, even though
* we are interrupting the locate to start a new one.
*/