diff options
author | Jonas Ã…dahl <jadahl@gmail.com> | 2016-05-26 22:44:49 +0800 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2019-08-21 18:15:44 +0100 |
commit | f829ddf31449f76292a0f0a2c3e7269802d41a32 (patch) | |
tree | 1908ad9f571ee074da6f71403d1cdb9c487a5631 | |
parent | e20594f83bd123c9904c18d6b3fd766c1433cd2c (diff) | |
download | clutter-f829ddf31449f76292a0f0a2c3e7269802d41a32.tar.gz |
tests/conform: Fix actor-offscreen-redirect
The actor-offscreen-redirect didn't initialize its state properly, so
it could potentially end up with the "was_painted" state being TRUE
from the start, effectively skipping the whole test.
Fixing so that the test even run resulted in the test getting stuck in
a dead lock due to the verification that a frame was drawn was done
from a paint callback. A paint callback had the mutex held, so when the
test case tried to run the main loop, the next paint callback caller
path taken would try to re-lock the same mutex, thus dead lock.
[Changes originally from the fork of clutter in mutter 3.21.4,
commit 9c0fa583.]
Fixes: https://gitlab.gnome.org/GNOME/clutter/issues/8
Bug-Debian: https://bugs.debian.org/931921
Signed-off-by: Simon McVittie <smcv@debian.org>
-rw-r--r-- | tests/conform/actor-offscreen-redirect.c | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/tests/conform/actor-offscreen-redirect.c b/tests/conform/actor-offscreen-redirect.c index f47af3617..63d5e6cfd 100644 --- a/tests/conform/actor-offscreen-redirect.c +++ b/tests/conform/actor-offscreen-redirect.c @@ -177,6 +177,33 @@ verify_redraw (Data *data, int expected_paint_count) } static gboolean +verify_redraws (gpointer user_data) +{ + Data *data = user_data; + + /* Queueing a redraw on the actor should cause a redraw */ + clutter_actor_queue_redraw (data->container); + verify_redraw (data, 1); + + /* Queueing a redraw on a child should cause a redraw */ + clutter_actor_queue_redraw (data->child); + verify_redraw (data, 1); + + /* Modifying the transformation on the parent should cause a + redraw */ + clutter_actor_set_anchor_point (data->parent_container, 0, 1); + verify_redraw (data, 1); + + /* Redrawing an unrelated actor shouldn't cause a redraw */ + clutter_actor_set_position (data->unrelated_actor, 0, 1); + verify_redraw (data, 0); + + data->was_painted = TRUE; + + return G_SOURCE_REMOVE; +} + +static gboolean run_verify (gpointer user_data) { Data *data = user_data; @@ -273,24 +300,8 @@ run_verify (gpointer user_data) 0, 255); - /* Queueing a redraw on the actor should cause a redraw */ - clutter_actor_queue_redraw (data->container); - verify_redraw (data, 1); - - /* Queueing a redraw on a child should cause a redraw */ - clutter_actor_queue_redraw (data->child); - verify_redraw (data, 1); - - /* Modifying the transformation on the parent should cause a - redraw */ - clutter_actor_set_anchor_point (data->parent_container, 0, 1); - verify_redraw (data, 1); - - /* Redrawing an unrelated actor shouldn't cause a redraw */ - clutter_actor_set_position (data->unrelated_actor, 0, 1); - verify_redraw (data, 0); - - data->was_painted = TRUE; + /* Check redraws */ + g_idle_add (verify_redraws, data); return G_SOURCE_REMOVE; } @@ -298,7 +309,7 @@ run_verify (gpointer user_data) static void actor_offscreen_redirect (void) { - Data data; + Data data = { 0 }; if (!cogl_features_available (COGL_FEATURE_OFFSCREEN)) return; |