Skip to content

Commit 07c33bd

Browse files
Razvan Becheriufxdupont
authored andcommitted
[#3991] catch all exceptions in destructor
1 parent 350a09b commit 07c33bd

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/lib/asiolink/unix_domain_socket.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ class UnixDomainSocketImpl : public boost::enable_shared_from_this<UnixDomainSoc
3232
/// @brief Destructor.
3333
///
3434
/// Closes the socket.
35-
// cppcheck-suppress throwInNoexceptFunction
3635
~UnixDomainSocketImpl() {
37-
close();
36+
try {
37+
close();
38+
} catch (...) {
39+
// catch all exceptions.
40+
}
3841
}
3942

4043
/// @brief Asynchronously connects to an endpoint.

src/lib/util/unlock_guard.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ class UnlockGuard : public boost::noncopyable {
3232
/// @brief Destructor.
3333
///
3434
/// Lock mutex object on destructor.
35-
// cppcheck-suppress throwInNoexceptFunction
3635
~UnlockGuard() {
37-
lock_.lock();
36+
try {
37+
lock_.lock();
38+
} catch (...) {
39+
// catch all exceptions.
40+
}
3841
}
3942

4043
private:

0 commit comments

Comments
 (0)