forked from external/yambar
bar/wayland: wl_* APIs typically don't handle destroy(NULL)
This commit is contained in:
parent
a831490462
commit
0fc5778107
1 changed files with 39 additions and 19 deletions
|
@ -118,7 +118,8 @@ static const struct wl_shm_listener shm_listener = {
|
||||||
static void
|
static void
|
||||||
update_cursor_surface(struct wayland_backend *backend)
|
update_cursor_surface(struct wayland_backend *backend)
|
||||||
{
|
{
|
||||||
assert(backend->pointer.cursor != NULL);
|
if (backend->pointer.cursor == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
struct wl_cursor_image *image = backend->pointer.cursor->images[0];
|
struct wl_cursor_image *image = backend->pointer.cursor->images[0];
|
||||||
|
|
||||||
|
@ -582,37 +583,56 @@ cleanup(struct bar *_bar)
|
||||||
struct wayland_backend *backend = bar->backend.data;
|
struct wayland_backend *backend = bar->backend.data;
|
||||||
|
|
||||||
tll_foreach(backend->buffers, it) {
|
tll_foreach(backend->buffers, it) {
|
||||||
wl_buffer_destroy(it->item.wl_buf);
|
if (it->item.wl_buf != NULL)
|
||||||
cairo_destroy(it->item.cairo);
|
wl_buffer_destroy(it->item.wl_buf);
|
||||||
cairo_surface_destroy(it->item.cairo_surface);
|
if (it->item.cairo != NULL)
|
||||||
munmap(it->item.mmapped, it->item.size);
|
cairo_destroy(it->item.cairo);
|
||||||
|
if (it->item.cairo_surface != NULL)
|
||||||
|
cairo_surface_destroy(it->item.cairo_surface);
|
||||||
|
|
||||||
|
munmap(it->item.mmapped, it->item.size);
|
||||||
tll_remove(backend->buffers, it);
|
tll_remove(backend->buffers, it);
|
||||||
}
|
}
|
||||||
|
|
||||||
tll_foreach(backend->monitors, it) {
|
tll_foreach(backend->monitors, it) {
|
||||||
struct monitor *mon = &it->item;
|
struct monitor *mon = &it->item;
|
||||||
free(mon->name);
|
free(mon->name);
|
||||||
zxdg_output_v1_destroy(mon->xdg);
|
|
||||||
wl_output_destroy(mon->output);
|
if (mon->xdg != NULL)
|
||||||
|
zxdg_output_v1_destroy(mon->xdg);
|
||||||
|
if (mon->output != NULL)
|
||||||
|
wl_output_destroy(mon->output);
|
||||||
tll_remove(backend->monitors, it);
|
tll_remove(backend->monitors, it);
|
||||||
}
|
}
|
||||||
zxdg_output_manager_v1_destroy(backend->xdg_output_manager);
|
|
||||||
|
if (backend->xdg_output_manager != NULL)
|
||||||
|
zxdg_output_manager_v1_destroy(backend->xdg_output_manager);
|
||||||
|
|
||||||
/* TODO: move to bar */
|
/* TODO: move to bar */
|
||||||
free(bar->cursor_name);
|
free(bar->cursor_name);
|
||||||
|
|
||||||
zwlr_layer_surface_v1_destroy(backend->layer_surface);
|
if (backend->layer_surface != NULL)
|
||||||
zwlr_layer_shell_v1_destroy(backend->layer_shell);
|
zwlr_layer_surface_v1_destroy(backend->layer_surface);
|
||||||
wl_cursor_theme_destroy(backend->pointer.theme);
|
if (backend->layer_shell != NULL)
|
||||||
wl_pointer_destroy(backend->pointer.pointer);
|
zwlr_layer_shell_v1_destroy(backend->layer_shell);
|
||||||
wl_surface_destroy(backend->pointer.surface);
|
if (backend->pointer.theme != NULL)
|
||||||
wl_surface_destroy(backend->surface);
|
wl_cursor_theme_destroy(backend->pointer.theme);
|
||||||
wl_seat_destroy(backend->seat);
|
if (backend->pointer.pointer != NULL)
|
||||||
wl_compositor_destroy(backend->compositor);
|
wl_pointer_destroy(backend->pointer.pointer);
|
||||||
wl_shm_destroy(backend->shm);
|
if (backend->pointer.surface != NULL)
|
||||||
wl_registry_destroy(backend->registry);
|
wl_surface_destroy(backend->pointer.surface);
|
||||||
wl_display_disconnect(backend->display);
|
if (backend->surface != NULL)
|
||||||
|
wl_surface_destroy(backend->surface);
|
||||||
|
if (backend->seat != NULL)
|
||||||
|
wl_seat_destroy(backend->seat);
|
||||||
|
if (backend->compositor != NULL)
|
||||||
|
wl_compositor_destroy(backend->compositor);
|
||||||
|
if (backend->shm != NULL)
|
||||||
|
wl_shm_destroy(backend->shm);
|
||||||
|
if (backend->registry != NULL)
|
||||||
|
wl_registry_destroy(backend->registry);
|
||||||
|
if (backend->display != NULL)
|
||||||
|
wl_display_disconnect(backend->display);
|
||||||
|
|
||||||
/* Destroyed when freeing buffer list */
|
/* Destroyed when freeing buffer list */
|
||||||
bar->cairo_surface = NULL;
|
bar->cairo_surface = NULL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue