From 09772ddf5bbd9abebe5f8a010e0739a40d4850d3 Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Fri, 27 Dec 2019 14:41:54 +0000 Subject: [PATCH] Clean up some resources --- include/screencopy.h | 1 + src/main.c | 17 ++++++++++++++--- src/screencopy.c | 6 ++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/include/screencopy.h b/include/screencopy.h index 10949ea..8e43251 100644 --- a/include/screencopy.h +++ b/include/screencopy.h @@ -31,3 +31,4 @@ struct screencopy { }; void screencopy_init(struct screencopy* self); +void screencopy_destroy(struct screencopy* self); diff --git a/src/main.c b/src/main.c index a466086..1fcda4b 100644 --- a/src/main.c +++ b/src/main.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -188,13 +189,22 @@ static void registry_remove(void* data, struct wl_registry* registry, void wayvnc_destroy(struct wayvnc* self) { output_list_destroy(&self->outputs); + + wl_seat_destroy(self->seat); + wl_shm_destroy(self->screencopy_backend.wl_shm); + zwp_virtual_keyboard_v1_destroy(self->keyboard_backend.virtual_keyboard); zwp_virtual_keyboard_manager_v1_destroy(self->keyboard_manager); + keyboard_destroy(&self->keyboard_backend); + zwlr_virtual_pointer_manager_v1_destroy(self->pointer_backend.manager); - if (self->dmabuf_backend.manager) { - pointer_destroy(&self->pointer_backend); + pointer_destroy(&self->pointer_backend); + + zwlr_screencopy_manager_v1_destroy(self->screencopy_backend.manager); + + if (self->dmabuf_backend.manager) zwlr_export_dmabuf_manager_v1_destroy(self->dmabuf_backend.manager); - } + wl_display_disconnect(self->display); } @@ -619,6 +629,7 @@ int main(int argc, char* argv[]) nvnc_close(self.nvnc); renderer_destroy(&self.renderer); + screencopy_destroy(&self.screencopy_backend); wayvnc_destroy(&self); return 0; diff --git a/src/screencopy.c b/src/screencopy.c index 5605430..a2b220d 100644 --- a/src/screencopy.c +++ b/src/screencopy.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -189,3 +190,8 @@ void screencopy_init(struct screencopy* self) self->frame_capture.backend.start = screencopy_start; self->frame_capture.backend.stop = screencopy_stop; } + +void screencopy_destroy(struct screencopy* self) +{ + wl_buffer_destroy(self->buffer); +}