From a1da2b6ac56a35bb46e9a32317d894d9595e3dc4 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 28 Jan 2025 10:05:49 +0100 Subject: Fix uncaught clipboard network errors All communication with the server needs to be prepared for network errors. --- vncviewer/Viewport.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index 7dd1ea41..1359b571 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -545,7 +545,12 @@ void Viewport::handleClipboardChange(int source, void *data) vlog.debug("Got non-plain text in local clipboard, ignoring."); // Reset the state as if we don't have any clipboard data at all self->pendingClientClipboard = false; - self->cc->announceClipboard(false); + try { + self->cc->announceClipboard(false); + } catch (std::exception& e) { + vlog.error("%s", e.what()); + abort_connection_with_unexpected_error(e); + } return; } @@ -555,7 +560,12 @@ void Viewport::handleClipboardChange(int source, void *data) vlog.debug("Local clipboard changed whilst not focused, will notify server later"); self->pendingClientClipboard = true; // Clear any older client clipboard from the server - self->cc->announceClipboard(false); + try { + self->cc->announceClipboard(false); + } catch (std::exception& e) { + vlog.error("%s", e.what()); + abort_connection_with_unexpected_error(e); + } return; } -- cgit v1.2.3