aboutsummaryrefslogtreecommitdiff
path: root/swaynag
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2020-03-29 09:53:52 +0200
committerSimon Ser <contact@emersion.fr>2020-03-29 11:17:32 +0200
commit484f7677b0d5e07eb0e42d70343c4951ac6f24cf (patch)
tree58dbae4ec3e461d41bf510cd7e791c6c9e3201ea /swaynag
parent214e3030e1dc8d30295cb30c8a2397d641c77ebf (diff)
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
Diffstat (limited to 'swaynag')
-rw-r--r--swaynag/main.c2
-rw-r--r--swaynag/swaynag.c2
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, &registry_listener, swaynag);