1
0
Fork 0

test-runner: Disconnect display-opened signal on destruction

When running multiple tests at once (with --all) as in the
installed-tests cases, we may open and close the display multiple times,
this leads to setting the alarm filter each time that the x11 display is
opened (causing a critical error) because we never disconnect from the
::x11-display-opened signal.

So disconnect from the signal on test destruction, to avoid this to be
emitted multiple times.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1876>
This commit is contained in:
Jonas Ådahl 2021-05-26 19:31:02 +02:00 committed by Marco Trevisan (Treviño)
parent 955eb64269
commit e15b4b8fbe

View file

@ -40,6 +40,7 @@ typedef struct {
AsyncWaiter *waiter; AsyncWaiter *waiter;
GString *warning_messages; GString *warning_messages;
GMainLoop *loop; GMainLoop *loop;
gulong x11_display_opened_handler_id;
} TestCase; } TestCase;
static gboolean static gboolean
@ -87,6 +88,7 @@ test_case_new (void)
if (display->x11_display) if (display->x11_display)
on_x11_display_opened (display, test); on_x11_display_opened (display, test);
else else
test->x11_display_opened_handler_id =
g_signal_connect (meta_get_display (), "x11-display-opened", g_signal_connect (meta_get_display (), "x11-display-opened",
G_CALLBACK (on_x11_display_opened), G_CALLBACK (on_x11_display_opened),
test); test);
@ -885,6 +887,7 @@ test_case_destroy (TestCase *test,
*/ */
GHashTableIter iter; GHashTableIter iter;
gpointer key, value; gpointer key, value;
MetaDisplay *display;
g_hash_table_iter_init (&iter, test->clients); g_hash_table_iter_init (&iter, test->clients);
while (g_hash_table_iter_next (&iter, &key, &value)) while (g_hash_table_iter_next (&iter, &key, &value))
@ -906,11 +909,10 @@ test_case_destroy (TestCase *test,
g_clear_pointer (&test->waiter, async_waiter_destroy); g_clear_pointer (&test->waiter, async_waiter_destroy);
if (meta_get_display ()->x11_display) display = meta_get_display ();
{ g_clear_signal_handler (&test->x11_display_opened_handler_id, display);
meta_x11_display_set_alarm_filter (meta_get_display ()->x11_display, if (display->x11_display)
NULL, NULL); meta_x11_display_set_alarm_filter (display->x11_display, NULL, NULL);
}
g_hash_table_destroy (test->clients); g_hash_table_destroy (test->clients);
g_free (test); g_free (test);