allocate with LISTEN_STATIC

Fixes: https://codeberg.org/dwl/dwl/issues/723
Supersedes: https://codeberg.org/dwl/dwl/pulls/724
This commit is contained in:
korei999 2025-02-02 01:38:47 +02:00 committed by Leonardo Hernández Hernández
parent d1c2f43498
commit aa69ed81b5
No known key found for this signature in database
GPG Key ID: E538897EE11B9624

5
dwl.c
View File

@ -79,7 +79,7 @@
#define END(A) ((A) + LENGTH(A))
#define TAGMASK ((1u << TAGCOUNT) - 1)
#define LISTEN(E, L, H) wl_signal_add((E), ((L)->notify = (H), (L)))
#define LISTEN_STATIC(E, H) do { static struct wl_listener _l = {.notify = (H)}; wl_signal_add((E), &_l); } while (0)
#define LISTEN_STATIC(E, H) do { struct wl_listener *_l = ecalloc(1, sizeof(*_l)); _l->notify = (H); wl_signal_add((E), _l); } while (0)
/* enums */
enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */
@ -906,6 +906,7 @@ commitpopup(struct wl_listener *listener, void *data)
box.y -= (type == LayerShell ? l->scene->node.y : c->geom.y);
wlr_xdg_popup_unconstrain_from_box(popup, &box);
wl_list_remove(&listener->link);
free(listener);
}
void
@ -1246,6 +1247,7 @@ destroydragicon(struct wl_listener *listener, void *data)
focusclient(focustop(selmon), 1);
motionnotify(0, NULL, 0, 0, 0, 0);
wl_list_remove(&listener->link);
free(listener);
}
void
@ -1255,6 +1257,7 @@ destroyidleinhibitor(struct wl_listener *listener, void *data)
* at this point the idle inhibitor is still in the list of the manager */
checkidleinhibitor(wlr_surface_get_root_surface(data));
wl_list_remove(&listener->link);
free(listener);
}
void