diff options
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/asyncnotification.cxx | 5 |
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() |