From 50f095d6e873302277292e0b46040e861b05d9fb Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Tue, 4 Jun 2024 21:09:02 +0000 Subject: [PATCH] Initialise VNC last This fixes deinitialisation ordering and makes it so that we don't start listening until everything else is initialised. --- src/main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main.c b/src/main.c index 2a6c363..113567b 100644 --- a/src/main.c +++ b/src/main.c @@ -1929,9 +1929,6 @@ int main(int argc, char* argv[]) else if (use_websocket) socket_type = SOCKET_TYPE_WEBSOCKET; - if (init_nvnc(&self, address, port, socket_type) < 0) - goto nvnc_failure; - if (!start_detached) { if (self.screencopy.manager) screencopy_init(&self.screencopy); @@ -1964,6 +1961,9 @@ int main(int argc, char* argv[]) if (!self.ctl) goto ctl_server_failure; + if (init_nvnc(&self, address, port, socket_type) < 0) + goto nvnc_failure; + if (self.display) wl_display_dispatch_pending(self.display); @@ -1997,11 +1997,10 @@ int main(int argc, char* argv[]) return 0; +nvnc_failure: + ctl_server_destroy(self.ctl); ctl_server_failure: capture_failure: - nvnc_display_unref(self.nvnc_display); - nvnc_close(self.nvnc); -nvnc_failure: wayland_failure: aml_unref(aml); failure: