diff options
author | Pierre Ossman <ossman@cendio.se> | 2025-01-28 10:05:49 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2025-01-28 10:05:49 +0100 |
commit | a1da2b6ac56a35bb46e9a32317d894d9595e3dc4 (patch) | |
tree | 67954a4f806ab75d415a694f39b463c48376c8c9 | |
parent | 57f7eec4b86979829012ba7c4821b7a51b522316 (diff) | |
download | tigervnc-a1da2b6ac56a35bb46e9a32317d894d9595e3dc4.tar.gz tigervnc-a1da2b6ac56a35bb46e9a32317d894d9595e3dc4.zip |
Fix uncaught clipboard network errors
All communication with the server needs to be prepared for network
errors.
-rw-r--r-- | vncviewer/Viewport.cxx | 14 |
1 files 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; } |