diff --git a/types/wlr_wl_shell.c b/types/wlr_wl_shell.c index c95845e8..378758e8 100644 --- a/types/wlr_wl_shell.c +++ b/types/wlr_wl_shell.c @@ -145,6 +145,7 @@ void wlr_wl_shell_destroy(struct wlr_wl_shell *wlr_wl_shell) { wl_list_remove(link); } // TODO: destroy surfaces - wl_global_destroy(wlr_wl_shell->wl_global); + // TODO: this segfault (wl_display->registry_resource_list is not init) + // wl_global_destroy(wlr_wl_shell->wl_global); free(wlr_wl_shell); } diff --git a/types/wlr_xdg_shell_v6.c b/types/wlr_xdg_shell_v6.c index da3c05df..45c5a3f0 100644 --- a/types/wlr_xdg_shell_v6.c +++ b/types/wlr_xdg_shell_v6.c @@ -158,12 +158,15 @@ static void xdg_shell_pong(struct wl_client *client, } static struct zxdg_shell_v6_interface xdg_shell_impl = { - .destroy = resource_destroy, .create_positioner = xdg_shell_create_positioner, .get_xdg_surface = xdg_shell_get_xdg_surface, .pong = xdg_shell_pong, }; +static void xdg_shell_destroy(struct wl_resource *resource) { + wl_list_remove(wl_resource_get_link(resource)); +} + static void xdg_shell_bind(struct wl_client *wl_client, void *_xdg_shell, uint32_t version, uint32_t id) { struct wlr_xdg_shell_v6 *xdg_shell = _xdg_shell; @@ -175,7 +178,7 @@ static void xdg_shell_bind(struct wl_client *wl_client, void *_xdg_shell, } struct wl_resource *wl_resource = wl_resource_create( wl_client, &zxdg_shell_v6_interface, version, id); - wl_resource_set_implementation(wl_resource, &xdg_shell_impl, xdg_shell, NULL); + wl_resource_set_implementation(wl_resource, &xdg_shell_impl, xdg_shell, xdg_shell_destroy); wl_list_insert(&xdg_shell->wl_resources, wl_resource_get_link(wl_resource)); } @@ -207,6 +210,7 @@ void wlr_xdg_shell_v6_destroy(struct wlr_xdg_shell_v6 *xdg_shell) { wl_list_remove(link); } // TODO: destroy surfaces - wl_global_destroy(xdg_shell->wl_global); + // TODO: this segfault (wl_display->registry_resource_list is not init) + // wl_global_destroy(xdg_shell->wl_global); free(xdg_shell); }