diff --git a/tests/interactive/test-multistage.c b/tests/interactive/test-multistage.c index 52aa7cbfc..7f7af0d51 100644 --- a/tests/interactive/test-multistage.c +++ b/tests/interactive/test-multistage.c @@ -3,6 +3,7 @@ #undef CLUTTER_DISABLE_DEPRECATED #include +static GList *stages = NULL; static gint n_stages = 1; static gboolean @@ -15,6 +16,12 @@ tex_button_cb (ClutterActor *actor, return TRUE; } +static void +on_destroy (ClutterActor *actor) +{ + stages = g_list_remove (stages, actor); +} + static gboolean on_button_press (ClutterActor *actor, ClutterEvent *event, @@ -35,6 +42,8 @@ on_button_press (ClutterActor *actor, clutter_stage_set_color (CLUTTER_STAGE (new_stage), CLUTTER_COLOR_DarkScarletRed); clutter_actor_set_size (new_stage, 320, 240); + g_signal_connect (new_stage, "destroy", G_CALLBACK (on_destroy), NULL); + tex = clutter_texture_new_from_file (TESTS_DATADIR G_DIR_SEPARATOR_S "redhand.png", @@ -91,6 +100,8 @@ on_button_press (ClutterActor *actor, clutter_actor_show_all (new_stage); + stages = g_list_prepend (stages, new_stage); + return TRUE; } @@ -127,5 +138,8 @@ test_multistage_main (int argc, char *argv[]) clutter_main (); + g_list_foreach (stages, (GFunc) clutter_actor_destroy, NULL); + g_list_free (stages); + return 0; }