From bf98c1a8f2872d3da2be895d9a7f56ada65d43d5 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 26 Aug 2021 14:50:59 -0500 Subject: [PATCH] tests: Destroy custom global object Destroy our custom global object at end of run so we no longer "leak" it. Signed-off-by: Derek Foreman --- tests/test-compositor.c | 9 +++++---- tests/test-compositor.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test-compositor.c b/tests/test-compositor.c index 468ee56d..103ddc85 100644 --- a/tests/test-compositor.c +++ b/tests/test-compositor.c @@ -329,7 +329,6 @@ struct display * display_create(void) { struct display *d = NULL; - struct wl_global *g; const char *socket_name; int stat = 0; @@ -350,9 +349,10 @@ display_create(void) wl_list_init(&d->waiting_for_resume); d->wfr_num = 0; - g = wl_global_create(d->wl_display, &test_compositor_interface, - 1, d, tc_bind); - assert(g && "Creating test global failed"); + d->test_global = wl_global_create(d->wl_display, + &test_compositor_interface, + 1, d, tc_bind); + assert(d->test_global && "Creating test global failed"); return d; } @@ -410,6 +410,7 @@ display_destroy(struct display *d) free(cl); } + wl_global_destroy(d->test_global); wl_display_destroy(d->wl_display); free(d); diff --git a/tests/test-compositor.h b/tests/test-compositor.h index 180dad25..f763fef3 100644 --- a/tests/test-compositor.h +++ b/tests/test-compositor.h @@ -46,6 +46,7 @@ struct client_info { struct display { struct wl_display *wl_display; + struct wl_global *test_global; struct wl_list clients; uint32_t clients_no;