cid#1607861 Data race condition

Change-Id: Ib58f6613b98b2b778c9894359fe92b6fcf33298d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174293
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2024-09-30 19:35:01 +02:00 committed by Noel Grandin
parent ccef1a40d4
commit 9a2f11cc1f

View file

@ -38,7 +38,7 @@ namespace dbaui
class OAsynchronousLink final class OAsynchronousLink final
{ {
Link<void*,void> m_aHandler; Link<void*,void> m_aHandler;
std::mutex m_aEventSafety; mutable std::mutex m_aEventSafety;
std::mutex m_aDestructionSafety; std::mutex m_aDestructionSafety;
ImplSVEvent * m_nEventId; ImplSVEvent * m_nEventId;
DECL_LINK(OnAsyncCall, void*, void); DECL_LINK(OnAsyncCall, void*, void);
@ -50,7 +50,11 @@ namespace dbaui
OAsynchronousLink( const Link<void*,void>& _rHandler ); OAsynchronousLink( const Link<void*,void>& _rHandler );
~OAsynchronousLink(); ~OAsynchronousLink();
bool IsRunning() const { return m_nEventId != nullptr; } bool IsRunning() const
{
std::unique_lock aEventGuard(m_aEventSafety);
return m_nEventId != nullptr;
}
void Call( void* _pArgument = nullptr ); void Call( void* _pArgument = nullptr );
void CancelCall(); void CancelCall();