summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-12-03 09:29:56 +0100
committerStephan Bergmann <sbergman@redhat.com>2021-12-03 11:00:03 +0100
commit0c1c300ed7ce168755ae945822eb7a1c610cfa25 (patch)
treec090b924d97765bbef812b36e9ae084b94419f94 /comphelper
parent7f02cb80ac2075b65ee1adee4e29d1d5c4819424 (diff)
Rather use ScopeGuard to prevent catch and rethrow
...than 6bc5d6cac2fd9e029357c618510a3b5f3aa7c085 "remove counter-productive catch-all blocks" Change-Id: I07fe5821ef5bf60f74f5ceb5feedd7dc79e73dfa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126275 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/asyncnotification.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/comphelper/source/misc/asyncnotification.cxx b/comphelper/source/misc/asyncnotification.cxx
index e2c5691899d3..81552d9750cf 100644
--- a/comphelper/source/misc/asyncnotification.cxx
+++ b/comphelper/source/misc/asyncnotification.cxx
@@ -18,6 +18,7 @@
*/
#include <comphelper/asyncnotification.hxx>
+#include <comphelper/scopeguard.hxx>
#include <mutex>
#include <condition_variable>
#include <osl/mutex.hxx>
@@ -231,16 +232,20 @@ namespace comphelper
{
// see salhelper::Thread::launch
xThis->m_xImpl->pKeepThisAlive = xThis;
+ comphelper::ScopeGuard g([&xThis] { xThis->m_xImpl->pKeepThisAlive.reset(); });
if (!xThis->create()) {
throw std::runtime_error("osl::Thread::create failed");
}
+ g.dismiss();
}
void AsyncEventNotifierAutoJoin::run()
{
// see salhelper::Thread::run
+ comphelper::ScopeGuard g([this] { onTerminated(); });
setName(m_xImpl->name);
execute();
+ g.dismiss();
}
void AsyncEventNotifierAutoJoin::onTerminated()