mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-17 06:46:39 -04:00
examples: assert on memory allocation
Also checks for NULL output in the `X_from_device` functions
This commit is contained in:
parent
ebef710746
commit
7cb206deb4
11 changed files with 39 additions and 1 deletions
|
|
@ -72,6 +72,7 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
|
|||
wlr_output_init_render(wlr_output, server->allocator, server->renderer);
|
||||
|
||||
struct output *output = calloc(1, sizeof(*output));
|
||||
assert(output);
|
||||
output->wlr = wlr_output;
|
||||
output->server = server;
|
||||
output->frame.notify = output_handle_frame;
|
||||
|
|
@ -124,6 +125,7 @@ static void server_handle_new_surface(struct wl_listener *listener,
|
|||
server->surface_offset += 50;
|
||||
|
||||
struct surface *surface = calloc(1, sizeof(*surface));
|
||||
assert(surface);
|
||||
surface->wlr = wlr_surface;
|
||||
surface->commit.notify = surface_handle_commit;
|
||||
wl_signal_add(&wlr_surface->events.commit, &surface->commit);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue