From e46d2c36d82c7e8f385ead5947446d7161b9aaf9 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 7 Nov 2022 13:45:34 +0100 Subject: [PATCH] Flush decoder errors on close() We don't want any stray exceptions as we are cleaning up, so handle any still pending decoder errors by just logging them. We are already shutting down so there is no need to abort the connection here. --- common/rfb/CConnection.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx index 675b49d6..396b48b3 100644 --- a/common/rfb/CConnection.cxx +++ b/common/rfb/CConnection.cxx @@ -388,6 +388,16 @@ void CConnection::close() { state_ = RFBSTATE_CLOSING; + /* + * We're already shutting down, so just log any pending decoder + * problems + */ + try { + decoder.flush(); + } catch (rdr::Exception& e) { + vlog.error("%s", e.str()); + } + setFramebuffer(NULL); delete csecurity; csecurity = NULL; -- 2.39.5