tinywl: assert on memory allocation

This commit is contained in:
Simon Zeni 2024-04-08 10:12:14 -04:00
parent 7cb206deb4
commit b18aec3625

View file

@ -250,6 +250,7 @@ static void server_new_keyboard(struct tinywl_server *server,
struct wlr_keyboard *wlr_keyboard = wlr_keyboard_from_input_device(device); struct wlr_keyboard *wlr_keyboard = wlr_keyboard_from_input_device(device);
struct tinywl_keyboard *keyboard = calloc(1, sizeof(*keyboard)); struct tinywl_keyboard *keyboard = calloc(1, sizeof(*keyboard));
assert(keyboard);
keyboard->server = server; keyboard->server = server;
keyboard->wlr_keyboard = wlr_keyboard; keyboard->wlr_keyboard = wlr_keyboard;
@ -625,6 +626,7 @@ static void server_new_output(struct wl_listener *listener, void *data) {
/* Allocates and configures our state for this output */ /* Allocates and configures our state for this output */
struct tinywl_output *output = calloc(1, sizeof(*output)); struct tinywl_output *output = calloc(1, sizeof(*output));
assert(output);
output->wlr_output = wlr_output; output->wlr_output = wlr_output;
output->server = server; output->server = server;
@ -801,6 +803,7 @@ static void server_new_xdg_toplevel(struct wl_listener *listener, void *data) {
/* Allocate a tinywl_toplevel for this surface */ /* Allocate a tinywl_toplevel for this surface */
struct tinywl_toplevel *toplevel = calloc(1, sizeof(*toplevel)); struct tinywl_toplevel *toplevel = calloc(1, sizeof(*toplevel));
assert(toplevel);
toplevel->server = server; toplevel->server = server;
toplevel->xdg_toplevel = xdg_toplevel; toplevel->xdg_toplevel = xdg_toplevel;
toplevel->scene_tree = toplevel->scene_tree =
@ -859,6 +862,7 @@ static void server_new_xdg_popup(struct wl_listener *listener, void *data) {
struct wlr_xdg_popup *xdg_popup = data; struct wlr_xdg_popup *xdg_popup = data;
struct tinywl_popup *popup = calloc(1, sizeof(*popup)); struct tinywl_popup *popup = calloc(1, sizeof(*popup));
assert(popup);
popup->xdg_popup = xdg_popup; popup->xdg_popup = xdg_popup;
/* We must add xdg popups to the scene graph so they get rendered. The /* We must add xdg popups to the scene graph so they get rendered. The