From ccefe3ef45c3a42fe69f3643bae55d6c91a71c19 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Thu, 9 Apr 2026 00:19:26 +0100 Subject: [PATCH] tests: Don't leak test idle source on full-skip If the compositor fails to initialise in such a way that we want to skip, don't leak the idle source. This fixes the ASan failure, but still results in a TAP-parsing failure. Signed-off-by: Daniel Stone --- tests/harness/weston-test.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/harness/weston-test.c b/tests/harness/weston-test.c index ccd961156..59f54644c 100644 --- a/tests/harness/weston-test.c +++ b/tests/harness/weston-test.c @@ -69,6 +69,8 @@ struct weston_test { struct wl_list output_list; struct wl_listener output_created_listener; struct wl_listener output_destroyed_listener; + + struct wl_event_source *launch_source; }; struct weston_test_surface { @@ -776,6 +778,8 @@ idle_launch_testsuite(void *test_) struct weston_test *test = test_; struct wet_testsuite_data *data = weston_compositor_get_test_data(test->compositor); + test->launch_source = NULL; + if (!data) return; @@ -832,6 +836,13 @@ handle_compositor_destroy(struct wl_listener *listener, client_thread_join(test); } + if (test->launch_source) { + weston_log_scope_printf(test->log, + "Test cancelled during initialization\n"); + wl_event_source_remove(test->launch_source); + test->launch_source = NULL; + } + if (test->is_seat_initialized) test_seat_release(test); @@ -888,7 +899,8 @@ wet_module_init(struct weston_compositor *ec, goto out_free; loop = wl_display_get_event_loop(ec->wl_display); - wl_event_loop_add_idle(loop, idle_launch_testsuite, test); + test->launch_source = + wl_event_loop_add_idle(loop, idle_launch_testsuite, test); return 0;