diff options
Diffstat (limited to 'comphelper/source/misc/asyncnotification.cxx')
-rw-r--r-- | comphelper/source/misc/asyncnotification.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/comphelper/source/misc/asyncnotification.cxx b/comphelper/source/misc/asyncnotification.cxx index e2c5691899d3..72c6414e7281 100644 --- a/comphelper/source/misc/asyncnotification.cxx +++ b/comphelper/source/misc/asyncnotification.cxx @@ -18,9 +18,9 @@ */ #include <comphelper/asyncnotification.hxx> +#include <comphelper/scopeguard.hxx> #include <mutex> #include <condition_variable> -#include <osl/mutex.hxx> #include <cassert> #include <stdexcept> @@ -91,7 +91,7 @@ namespace comphelper std::scoped_lock aGuard( m_xImpl->aMutex ); // remove all events for this processor - m_xImpl->aEvents.erase(std::remove_if( m_xImpl->aEvents.begin(), m_xImpl->aEvents.end(), EqualProcessor( _xProcessor ) ), m_xImpl->aEvents.end()); + std::erase_if( m_xImpl->aEvents, EqualProcessor( _xProcessor ) ); } @@ -231,16 +231,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() |