1
0
Fork 0

tests/clutter/event-delivery: Avoid race with stage update

`clutter_actor_destroy()` queues a stage update. Under certain
circumstances - i.e. when run in a very slow container - this can race
with the stage update triggered by the following
`clutter_virtual_input_device_notify_button()`, occasionally resulting in
`wait_stage_updated()` to return before the
`on_event_return_propagate()` callbacks ran, making the test fail.

This notably became more common since

8f27ebf87e (clutter/frame-clock: Start next update ASAP after idle period)

landed.

Thus wait for a stage update to happen after `clutter_actor_destroy()`,
preventing the race.

Fixes: f6da583d06 (tests/clutter/event-delivery: Add tests for implicit grabbing)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3332>
This commit is contained in:
Robert Mader 2023-10-18 07:41:34 +02:00
parent 8f27ebf87e
commit b5a59ec109

View file

@ -329,6 +329,7 @@ event_delivery_implicit_grab_cancelled (void)
n_child_1_leave_events = n_child_2_leave_events = n_stage_leave_events = 0;
n_action_sequences_cancelled = 0;
clutter_actor_destroy (child_1);
wait_stage_updated (&was_updated);
g_assert_cmpint (n_child_1_enter_events, ==, 0);
g_assert_cmpint (n_child_1_leave_events, ==, 0);
g_assert_cmpint (n_action_sequences_cancelled, ==, 1);