From f36d92ab4e5f5f07c98f24cc20b368e83c0e1bc7 Mon Sep 17 00:00:00 2001 From: Avia Avraham <145359432+AviaAv@users.noreply.github.com> Date: Tue, 31 Dec 2024 10:13:33 +0200 Subject: [PATCH] fix abort in some cases with DDS --- .../realdds/src/dds-network-adapter-watcher.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/third-party/realdds/src/dds-network-adapter-watcher.cpp b/third-party/realdds/src/dds-network-adapter-watcher.cpp index 4cd3fd1e6d..348ece59fa 100644 --- a/third-party/realdds/src/dds-network-adapter-watcher.cpp +++ b/third-party/realdds/src/dds-network-adapter-watcher.cpp @@ -60,7 +60,6 @@ class network_adapter_watcher_singleton if( new_ips.size() || old_ips.size() ) callbacks.raise( new_ips, old_ips ); } - _th.detach(); // so it's not joinable LOG_DEBUG( "done waiting for IP changes" ); } ); } @@ -72,8 +71,15 @@ class network_adapter_watcher_singleton ~network_adapter_watcher_singleton() { _adapter_watcher.reset(); // signal the thread to finish - if( _th.joinable() ) - _th.join(); + try + { + if (_th.joinable()) + _th.join(); + } + catch (std::exception& e) + { + LOG_DEBUG("Network adapter watcher termination failed: " << e.what()); + } } void update_ips( ip_set * p_new_ips = nullptr, ip_set * p_old_ips = nullptr )