ucb/source/cacher/dynamicresultsetwrapper.cxx | 11 ++++++----- ucb/source/cacher/dynamicresultsetwrapper.hxx | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-)
New commits: commit 4d3ca43ac71cabd6071afa2306e4a82857f7b962 Author: Caolán McNamara <[email protected]> AuthorDate: Sat Aug 23 19:24:59 2025 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Tue Sep 2 16:16:22 2025 +0200 cid#1659708 Data race condition Change-Id: I599782383b48417841854fbf0cea213b3316e18d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190518 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/ucb/source/cacher/dynamicresultsetwrapper.cxx b/ucb/source/cacher/dynamicresultsetwrapper.cxx index ffa698799baa..5b40c24c272e 100644 --- a/ucb/source/cacher/dynamicresultsetwrapper.cxx +++ b/ucb/source/cacher/dynamicresultsetwrapper.cxx @@ -238,11 +238,12 @@ void DynamicResultSetWrapper::impl_notify( const ListEvent& Changes ) } OSL_ENSURE( m_bGotWelcome, "first notification was without WELCOME" ); - aGuard.unlock(); + m_aListenerSet.wait(aGuard, [this]{ return m_xListener.is(); }); + + Reference<XDynamicResultSetListener> xListener = m_xListener; - if( !m_xListener.is() ) - m_aListenerSet.wait(); - m_xListener->notify( aNewEvent ); + aGuard.unlock(); + xListener->notify( aNewEvent ); /* m_bUseOne = !m_bUseOne; @@ -340,7 +341,7 @@ void SAL_CALL DynamicResultSetWrapper::setListener( const Reference< XDynamicRes if ( xSource.is() ) xSource->setListener( xMyListenerImpl ); - m_aListenerSet.set(); + m_aListenerSet.notify_all(); } //virtual diff --git a/ucb/source/cacher/dynamicresultsetwrapper.hxx b/ucb/source/cacher/dynamicresultsetwrapper.hxx index ce4438b5cb43..0c580197d721 100644 --- a/ucb/source/cacher/dynamicresultsetwrapper.hxx +++ b/ucb/source/cacher/dynamicresultsetwrapper.hxx @@ -19,6 +19,7 @@ #pragma once +#include <condition_variable> #include <mutex> #include <osl/conditn.hxx> #include <cppuhelper/weak.hxx> @@ -71,7 +72,7 @@ protected: m_xListener; osl::Condition m_aSourceSet; - osl::Condition m_aListenerSet; + std::condition_variable m_aListenerSet; protected: void impl_init();
