From a99d1ca87d239a08ab654164cefae28d5f1fa781 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Mon, 29 Jul 2024 23:11:59 +0100 Subject: [PATCH] Catch exception propagating to `Server` dtor (#7416) * Catch throw in dtor * Update ChangeLog --- .vscode/settings.json | 6 +++++- ChangeLog | 1 + src/lib/server/Server.cpp | 7 ++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index e8afb2b3b..dae8c6ec1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,8 @@ { "sonarlint.pathToCompileCommands": "${workspaceFolder}/build/compile_commands.json", - "gcovViewer.buildDirectories": ["${workspaceFolder}/build/src/lib"] + "gcovViewer.buildDirectories": ["${workspaceFolder}/build/src/lib"], + "sonarlint.connectedMode.project": { + "connectionId": "symless", + "projectKey": "symless_synergy-core" + } } diff --git a/ChangeLog b/ChangeLog index 04ce6042d..6ec02e122 100644 --- a/ChangeLog +++ b/ChangeLog @@ -62,6 +62,7 @@ Enhancements: - #7413 Improve UI design and reduce over-use of `#ifdef` - #7414 Expand BSD sockets poll tests and remove legacy-poll code - #7415 Assert arg value `num > 0` for BSD socket poll unblock pipe +- #7416 Catch exception propagating to `Server` dtor # 1.14.6 diff --git a/src/lib/server/Server.cpp b/src/lib/server/Server.cpp index c3057fcff..a0fa037d6 100644 --- a/src/lib/server/Server.cpp +++ b/src/lib/server/Server.cpp @@ -2071,7 +2071,12 @@ void Server::closeClient(BaseClientProxy *client, const char *msg) { // move client to closing list removeClient(client); - m_oldClients.insert(std::make_pair(client, timer)); + + try { + m_oldClients.insert(std::make_pair(client, timer)); + } catch (std::exception &e) { // NOSONAR + LOG((CLOG_ERR "failed to append old client: %s", e.what())); + } // if this client is the active screen then we have to // jump off of it