From 484f7677b0d5e07eb0e42d70343c4951ac6f24cf Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Sun, 29 Mar 2020 09:53:52 +0200 Subject: [PATCH] swaynag: fix segfault on exit when arguments are not correct swaynag_destroy is called on all cleanup cases and needs the lists to be valid, just init them early --- swaynag/main.c | 2 ++ swaynag/swaynag.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/swaynag/main.c b/swaynag/main.c index 542e3472..c8212415 100644 --- a/swaynag/main.c +++ b/swaynag/main.c @@ -27,6 +27,8 @@ int main(int argc, char **argv) { memset(&swaynag, 0, sizeof(swaynag)); swaynag.buttons = create_list(); + wl_list_init(&swaynag.outputs); + wl_list_init(&swaynag.seats); struct swaynag_button *button_close = calloc(sizeof(struct swaynag_button), 1); diff --git a/swaynag/swaynag.c b/swaynag/swaynag.c index e6fe9b21..06700e47 100644 --- a/swaynag/swaynag.c +++ b/swaynag/swaynag.c @@ -437,8 +437,6 @@ void swaynag_setup(struct swaynag *swaynag) { } swaynag->scale = 1; - wl_list_init(&swaynag->outputs); - wl_list_init(&swaynag->seats); struct wl_registry *registry = wl_display_get_registry(swaynag->display); wl_registry_add_listener(registry, ®istry_listener, swaynag);