diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-06-16 16:52:55 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-06-17 20:45:16 +0000 |
commit | 51192fa69388df69a7a5d8f03fec53de61b69050 (patch) | |
tree | f7005f1f21646623ccc83b72298f8f546be54dd1 | |
parent | 459e240eb4d64bd005e7afd84f3c4cfcf9460582 (diff) |
Resolves: tdf#82532 parent mutex dtored before child dtor uses it
Mutex belonged to DisposeListenerGridBridge which inherits from
FmXDisposeListener, FmXDisposeListener dtor accesses a reference
to the parent mutex in its dtor, but the mutex has been destroyed
at this point.
Move the mutex from parent to child. FWIW these classes are on
the candidate list to merge.
(cherry picked from commit e841ed93d6c6d817be1f7fdc18ff971325c861cc)
(cherry picked from commit 1c0d1199fe02666de0d162f071ce7e6e812a23df)
Change-Id: Ic639eaed97c2b0625c368ed249f09920af37f94e
Reviewed-on: https://gerrit.libreoffice.org/26382
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | include/svx/fmtools.hxx | 4 | ||||
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 3 | ||||
-rw-r--r-- | svx/source/form/fmtools.cxx | 10 |
3 files changed, 5 insertions, 12 deletions
diff --git a/include/svx/fmtools.hxx b/include/svx/fmtools.hxx index 3c970a0d50e7..dde82f371b47 100644 --- a/include/svx/fmtools.hxx +++ b/include/svx/fmtools.hxx @@ -161,10 +161,10 @@ class SAL_WARN_UNUSED FmXDisposeListener friend class FmXDisposeMultiplexer; FmXDisposeMultiplexer* m_pAdapter; - ::osl::Mutex& m_rMutex; + osl::Mutex m_aMutex; public: - FmXDisposeListener(::osl::Mutex& _rMutex) : m_pAdapter(nullptr), m_rMutex(_rMutex) { } + FmXDisposeListener() : m_pAdapter(nullptr) { } virtual ~FmXDisposeListener(); virtual void disposing(const css::lang::EventObject& _rEvent, sal_Int16 _nId) throw( css::uno::RuntimeException ) = 0; diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index d677cd3b1136..53bf0f894543 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -195,7 +195,6 @@ void GridFieldValueListener::dispose() class DisposeListenerGridBridge : public FmXDisposeListener { - osl::Mutex m_aMutex; DbGridControl& m_rParent; FmXDisposeMultiplexer* m_pRealListener; @@ -207,7 +206,7 @@ public: }; DisposeListenerGridBridge::DisposeListenerGridBridge(DbGridControl& _rParent, const Reference< XComponent >& _rxObject, sal_Int16 _rId) - :FmXDisposeListener(m_aMutex) + :FmXDisposeListener() ,m_rParent(_rParent) ,m_pRealListener(nullptr) { diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx index 8db5d5346f65..497bdeafd629 100644 --- a/svx/source/form/fmtools.cxx +++ b/svx/source/form/fmtools.cxx @@ -259,7 +259,6 @@ void CursorWrapper::ImplConstruct(const Reference< css::sdbc::XResultSet>& _rxCu m_xGeneric = m_xMoveOperations.get(); } - const CursorWrapper& CursorWrapper::operator=(const Reference< css::sdbc::XRowSet>& _rxCursor) { m_xMoveOperations.set(_rxCursor, UNO_QUERY); @@ -274,32 +273,28 @@ const CursorWrapper& CursorWrapper::operator=(const Reference< css::sdbc::XRowSe return *this; } - FmXDisposeListener::~FmXDisposeListener() { setAdapter(nullptr); } - void FmXDisposeListener::setAdapter(FmXDisposeMultiplexer* pAdapter) { if (m_pAdapter) { - ::osl::MutexGuard aGuard(m_rMutex); + ::osl::MutexGuard aGuard(m_aMutex); m_pAdapter->release(); m_pAdapter = nullptr; } if (pAdapter) { - ::osl::MutexGuard aGuard(m_rMutex); + ::osl::MutexGuard aGuard(m_aMutex); m_pAdapter = pAdapter; m_pAdapter->acquire(); } } - - FmXDisposeMultiplexer::FmXDisposeMultiplexer(FmXDisposeListener* _pListener, const Reference< css::lang::XComponent>& _rxObject, sal_Int16 _nId) :m_xObject(_rxObject) ,m_pListener(_pListener) @@ -311,7 +306,6 @@ FmXDisposeMultiplexer::FmXDisposeMultiplexer(FmXDisposeListener* _pListener, con m_xObject->addEventListener(this); } - FmXDisposeMultiplexer::~FmXDisposeMultiplexer() { } |