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 <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2021-08-26 14:50:59 -05:00
parent f736f11f99
commit bf98c1a8f2
2 changed files with 6 additions and 4 deletions

View file

@ -329,7 +329,6 @@ struct display *
display_create(void) display_create(void)
{ {
struct display *d = NULL; struct display *d = NULL;
struct wl_global *g;
const char *socket_name; const char *socket_name;
int stat = 0; int stat = 0;
@ -350,9 +349,10 @@ display_create(void)
wl_list_init(&d->waiting_for_resume); wl_list_init(&d->waiting_for_resume);
d->wfr_num = 0; d->wfr_num = 0;
g = wl_global_create(d->wl_display, &test_compositor_interface, d->test_global = wl_global_create(d->wl_display,
1, d, tc_bind); &test_compositor_interface,
assert(g && "Creating test global failed"); 1, d, tc_bind);
assert(d->test_global && "Creating test global failed");
return d; return d;
} }
@ -410,6 +410,7 @@ display_destroy(struct display *d)
free(cl); free(cl);
} }
wl_global_destroy(d->test_global);
wl_display_destroy(d->wl_display); wl_display_destroy(d->wl_display);
free(d); free(d);

View file

@ -46,6 +46,7 @@ struct client_info {
struct display { struct display {
struct wl_display *wl_display; struct wl_display *wl_display;
struct wl_global *test_global;
struct wl_list clients; struct wl_list clients;
uint32_t clients_no; uint32_t clients_no;