fix cleanup issues in xdg_surface_new

`view->surface` had not been set to a non-`NULL` value here, so it
was not yet appropriate to access its `resource` member. instead,
use the resource from the argument xdg_surface.

furthermore, we need to free the newly-allocated `xdg_toplevel_view`
before error return.
This commit is contained in:
bi4k8 2022-12-08 05:27:25 +00:00 committed by Johan Malm
parent 1ebf5bce90
commit 272221dae2

View file

@ -420,7 +420,8 @@ xdg_surface_new(struct wl_listener *listener, void *data)
view->scene_tree, xdg_surface);
if (!tree) {
/* TODO: might need further clean up */
wl_resource_post_no_memory(view->surface->resource);
wl_resource_post_no_memory(xdg_surface->resource);
free(xdg_toplevel_view);
return;
}
view->scene_node = &tree->node;