Skip to content

Commit

Permalink
Clear clipboard state when invalid UTF-8 string
Browse files Browse the repository at this point in the history
This was missed in commit 6f6d940.
  • Loading branch information
CendioHalim committed Feb 21, 2025
1 parent 917f4b9 commit dbc9e7b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions vncviewer/Viewport.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,14 @@ int Viewport::handle(int event)
case FL_PASTE:
if (!isValidUTF8(Fl::event_text(), Fl::event_length())) {
vlog.error("Invalid UTF-8 sequence in system clipboard");
// Reset the state as if we don't have any clipboard data at all
this->pendingClientClipboard = false;
try {
this->cc->announceClipboard(false);
} catch (std::exception& e) {
vlog.error("%s", e.what());
abort_connection_with_unexpected_error(e);
}
return 1;
}

Expand Down

0 comments on commit dbc9e7b

Please sign in to comment.