Fix for visual glitch due to race between Editor::update_current_screen being called and a locate event being processed.

git-svn-id: svn://localhost/ardour2/branches/3.0@4608 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-02-17 00:12:22 +00:00
parent 3e1eb6bcbd
commit 4565b73a39
6 changed files with 32 additions and 1 deletions

View File

@ -248,7 +248,8 @@ Editor::Editor ()
/* nudge */
nudge_clock (X_("nudge"), false, X_("NudgeClock"), true, true),
meters_running(false)
meters_running(false),
_pending_locate_request (false)
{
constructed = false;
@ -1280,6 +1281,8 @@ Editor::connect_to_session (Session *t)
session_connections.push_back (session->tempo_map().StateChanged.connect (mem_fun(*this, &Editor::tempo_map_changed)));
session_connections.push_back (session->Located.connect (mem_fun (*this, &Editor::located)));
edit_groups_changed ();
edit_point_clock.set_mode(AudioClock::BBT);
@ -5346,3 +5349,11 @@ Editor::idle_resize ()
resize_idle_id = -1;
return false;
}
void
Editor::located ()
{
ENSURE_GUI_THREAD (mem_fun (*this, &Editor::located));
_pending_locate_request = false;
}

View File

@ -2376,6 +2376,9 @@ public:
void visible_order_range (int*, int*) const;
bool y_movement_disallowed (int, int, int, int, int, std::bitset<512> const &, std::vector<int32_t> const &) const;
void located ();
bool _pending_locate_request;
};
#endif /* __ardour_editor_h__ */

View File

@ -232,6 +232,14 @@ double current = 0.0;
void
Editor::update_current_screen ()
{
if (_pending_locate_request) {
/* we don't update things when there's a pending locate request, otherwise
when the editor requests a locate there is a chance that this method
will move the playhead before the locate request is processed, causing
a visual glitch. */
return;
}
if (session && session->engine().running()) {
nframes64_t const frame = session->audible_frame();

View File

@ -2429,6 +2429,7 @@ Editor::cursor_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
if (item == &playhead_cursor->canvas_item) {
if (session) {
session->request_locate (playhead_cursor->current_frame, drag_info.was_rolling);
_pending_locate_request = true;
}
}
}
@ -2443,6 +2444,7 @@ Editor::cursor_drag_finished_ensure_locate_callback (ArdourCanvas::Item* item, G
if (item == &playhead_cursor->canvas_item) {
if (session) {
session->request_locate (playhead_cursor->current_frame, drag_info.was_rolling);
_pending_locate_request = true;
}
}
}

View File

@ -371,6 +371,9 @@ class Session : public PBD::StatefulDestructible
sigc::signal<void,nframes_t> Xrun;
sigc::signal<void> TransportLooped;
/** emitted when a locate has occurred */
sigc::signal<void> Located;
sigc::signal<void,RouteList&> RouteAdded;
void request_roll_at_and_return (nframes_t start, nframes_t return_to);

View File

@ -643,6 +643,10 @@ Session::start_locate (nframes_t target_frame, bool with_roll, bool with_flush,
}
/* XXX: not sure if this should be emitted here; perhaps it should happen
when the slave is actually followed */
Located (); /* EMIT SIGNAL */
} else {
locate (target_frame, with_roll, with_flush, with_loop);