diff options
-rw-r--r-- | comphelper/source/property/propmultiplex.cxx | 20 | ||||
-rw-r--r-- | extensions/source/propctrlr/submissionhandler.cxx | 2 | ||||
-rw-r--r-- | forms/source/component/DatabaseForm.cxx | 4 | ||||
-rw-r--r-- | forms/source/component/FormComponent.cxx | 4 | ||||
-rw-r--r-- | forms/source/component/clickableimage.cxx | 4 | ||||
-rw-r--r-- | include/comphelper/propmultiplex.hxx | 8 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/AddField.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/GroupsSorting.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/Navigator.cxx | 4 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ReportSection.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ReportWindow.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ScrollHelper.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/ui/report/SectionWindow.cxx | 2 | ||||
-rw-r--r-- | svx/source/fmcomp/gridcell.cxx | 2 | ||||
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 4 |
15 files changed, 38 insertions, 26 deletions
diff --git a/comphelper/source/property/propmultiplex.cxx b/comphelper/source/property/propmultiplex.cxx index 66a1545f852e..e8470d8a3848 100644 --- a/comphelper/source/property/propmultiplex.cxx +++ b/comphelper/source/property/propmultiplex.cxx @@ -32,8 +32,13 @@ using namespace ::com::sun::star::beans; OPropertyChangeListener::~OPropertyChangeListener() { - if (m_xAdapter.is()) - m_xAdapter->dispose(); + rtl::Reference<OPropertyChangeMultiplexer> xTmpAdapter; + { + std::unique_lock aGuard(m_aAdapterMutex); + xTmpAdapter = std::move(m_xAdapter); + } + if ( xTmpAdapter.is() ) + xTmpAdapter->dispose(); } @@ -45,8 +50,13 @@ void OPropertyChangeListener::_disposing(const EventObject&) void OPropertyChangeListener::disposeAdapter() { - if ( m_xAdapter.is() ) - m_xAdapter->dispose(); + rtl::Reference<OPropertyChangeMultiplexer> xTmpAdapter; + { + std::unique_lock aGuard(m_aAdapterMutex); + xTmpAdapter = std::move(m_xAdapter); + } + if ( xTmpAdapter.is() ) + xTmpAdapter->dispose(); // will automatically set a new adapter OSL_ENSURE( !m_xAdapter.is(), "OPropertyChangeListener::disposeAdapter: what did dispose do?" ); @@ -55,7 +65,7 @@ void OPropertyChangeListener::disposeAdapter() void OPropertyChangeListener::setAdapter(OPropertyChangeMultiplexer* pAdapter) { - ::osl::MutexGuard aGuard(m_rMutex); + std::unique_lock aGuard(m_aAdapterMutex); m_xAdapter = pAdapter; } diff --git a/extensions/source/propctrlr/submissionhandler.cxx b/extensions/source/propctrlr/submissionhandler.cxx index 3abbbd3f6375..d7db39b973f8 100644 --- a/extensions/source/propctrlr/submissionhandler.cxx +++ b/extensions/source/propctrlr/submissionhandler.cxx @@ -82,7 +82,7 @@ namespace pcr SubmissionPropertyHandler::SubmissionPropertyHandler( const Reference< XComponentContext >& _rxContext ) :PropertyHandlerComponent( _rxContext ) - ,OPropertyChangeListener( m_aMutex ) + ,OPropertyChangeListener() { } diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 9d121cdf654a..f32b95a4c482 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -226,7 +226,7 @@ Any SAL_CALL ODatabaseForm::queryAggregation(const Type& _rType) ODatabaseForm::ODatabaseForm(const Reference<XComponentContext>& _rxContext) :OFormComponents(_rxContext) ,OPropertySetAggregationHelper(OComponentHelper::rBHelper) - ,OPropertyChangeListener(m_aMutex) + ,OPropertyChangeListener() ,m_aLoadListeners(m_aMutex) ,m_aRowSetApproveListeners(m_aMutex) ,m_aSubmitListeners(m_aMutex) @@ -256,7 +256,7 @@ ODatabaseForm::ODatabaseForm(const Reference<XComponentContext>& _rxContext) ODatabaseForm::ODatabaseForm( const ODatabaseForm& _cloneSource ) :OFormComponents( _cloneSource ) ,OPropertySetAggregationHelper( OComponentHelper::rBHelper ) - ,OPropertyChangeListener( m_aMutex ) + ,OPropertyChangeListener() ,ODatabaseForm_BASE1() ,ODatabaseForm_BASE2() ,ODatabaseForm_BASE3() diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 4e134a4fec55..1bedf96fb41a 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -1133,7 +1133,7 @@ OBoundControlModel::OBoundControlModel( const OUString& _rUnoControlModelTypeName, const OUString& _rDefault, const bool _bCommitable, const bool _bSupportExternalBinding, const bool _bSupportsValidation ) :OControlModel( _rxFactory, _rUnoControlModelTypeName, _rDefault, false ) - ,OPropertyChangeListener( m_aMutex ) + ,OPropertyChangeListener() ,m_nValuePropertyAggregateHandle( -1 ) ,m_nFieldType( DataType::OTHER ) ,m_bValuePropertyMayBeVoid( false ) @@ -1162,7 +1162,7 @@ OBoundControlModel::OBoundControlModel( OBoundControlModel::OBoundControlModel( const OBoundControlModel* _pOriginal, const Reference< XComponentContext>& _rxFactory ) :OControlModel( _pOriginal, _rxFactory, true, false ) - ,OPropertyChangeListener( m_aMutex ) + ,OPropertyChangeListener() ,m_nValuePropertyAggregateHandle( _pOriginal->m_nValuePropertyAggregateHandle ) ,m_nFieldType( DataType::OTHER ) ,m_bValuePropertyMayBeVoid( _pOriginal->m_bValuePropertyMayBeVoid ) diff --git a/forms/source/component/clickableimage.cxx b/forms/source/component/clickableimage.cxx index 53a2337ac429..8c16660c731d 100644 --- a/forms/source/component/clickableimage.cxx +++ b/forms/source/component/clickableimage.cxx @@ -441,7 +441,7 @@ namespace frm OClickableImageBaseModel::OClickableImageBaseModel( const Reference< XComponentContext >& _rxFactory, const OUString& _rUnoControlModelTypeName, const OUString& rDefault ) :OControlModel( _rxFactory, _rUnoControlModelTypeName, rDefault ) - ,OPropertyChangeListener(m_aMutex) + ,OPropertyChangeListener() ,m_bDispatchUrlInternal(false) ,m_bProdStarted(false) { @@ -452,7 +452,7 @@ namespace frm OClickableImageBaseModel::OClickableImageBaseModel( const OClickableImageBaseModel* _pOriginal, const Reference<XComponentContext>& _rxFactory ) :OControlModel( _pOriginal, _rxFactory ) - ,OPropertyChangeListener( m_aMutex ) + ,OPropertyChangeListener() ,m_xGraphicObject( _pOriginal->m_xGraphicObject ) ,m_bDispatchUrlInternal(false) ,m_bProdStarted( false ) diff --git a/include/comphelper/propmultiplex.hxx b/include/comphelper/propmultiplex.hxx index 30285f3e6204..0f5263ea82a5 100644 --- a/include/comphelper/propmultiplex.hxx +++ b/include/comphelper/propmultiplex.hxx @@ -24,6 +24,7 @@ #include <cppuhelper/implbase.hxx> #include <comphelper/comphelperdllapi.h> #include <rtl/ref.hxx> +#include <mutex> #include <vector> namespace com::sun::star::beans { class XPropertySet; } @@ -46,11 +47,12 @@ namespace comphelper friend class OPropertyChangeMultiplexer; rtl::Reference<OPropertyChangeMultiplexer> m_xAdapter; - ::osl::Mutex& m_rMutex; + // We have our own mutex here for the m_xAdapter field, because we sit between two different objects + // which often have their own mutexes, and if we use a mutex from one of them, + // we end up with ABBA deadlock risks. + std::mutex m_aAdapterMutex; public: - OPropertyChangeListener(::osl::Mutex& _rMutex) - : m_rMutex(_rMutex) { } virtual ~OPropertyChangeListener(); /// @throws css::uno::RuntimeException diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx index 50a5cf5a5963..0289195c0545 100644 --- a/reportdesign/source/ui/dlg/AddField.cxx +++ b/reportdesign/source/ui/dlg/AddField.cxx @@ -61,7 +61,7 @@ IMPL_LINK(OAddFieldWindow, DragBeginHdl, bool&, rUnsetDragIcon, bool) OAddFieldWindow::OAddFieldWindow(weld::Window* pParent, uno::Reference< beans::XPropertySet > xRowSet) : GenericDialogController(pParent, u"modules/dbreport/ui/floatingfield.ui"_ustr, u"FloatingField"_ustr) - , ::comphelper::OPropertyChangeListener(m_aMutex) + , ::comphelper::OPropertyChangeListener() , ::comphelper::OContainerListener(m_aMutex) , m_xRowSet(std::move(xRowSet)) , m_xActions(m_xBuilder->weld_toolbar(u"toolbox"_ustr)) diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index 9998c037ac1a..8080f5d1a33b 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -785,7 +785,7 @@ Size OFieldExpressionControl::GetOptimalSize() const OGroupsSortingDialog::OGroupsSortingDialog(weld::Window* pParent, bool bReadOnly, OReportController* pController) : GenericDialogController(pParent, u"modules/dbreport/ui/floatingsort.ui"_ustr, u"FloatingSort"_ustr) - , OPropertyChangeListener(m_aMutex) + , OPropertyChangeListener() , m_pController(pController) , m_xGroups(m_pController->getReportDefinition()->getGroups()) , m_bReadOnly(bReadOnly) diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx index e0cc989c689a..d1c48ba4382a 100644 --- a/reportdesign/source/ui/dlg/Navigator.cxx +++ b/reportdesign/source/ui/dlg/Navigator.cxx @@ -202,7 +202,7 @@ public: }; NavigatorTree::NavigatorTree(std::unique_ptr<weld::TreeView> xTreeView, OReportController& rController) - : OPropertyChangeListener(m_aMutex) + : OPropertyChangeListener() , m_xTreeView(std::move(xTreeView)) , m_rController(rController) { @@ -672,7 +672,7 @@ void NavigatorTree::removeEntry(const weld::TreeIter& rEntry, bool bRemove) } NavigatorTree::UserData::UserData(NavigatorTree* pTree,uno::Reference<uno::XInterface> xContent) - : OPropertyChangeListener(m_aMutex) + : OPropertyChangeListener() , OContainerListener(m_aMutex) , m_xContent(std::move(xContent)) , m_pTree(pTree) diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index 61e38fff8e8c..ca9842cef7ab 100644 --- a/reportdesign/source/ui/report/ReportSection.cxx +++ b/reportdesign/source/ui/report/ReportSection.cxx @@ -73,7 +73,7 @@ static Color lcl_getOverlappedControlColor(/*const uno::Reference <lang::XMultiS OReportSection::OReportSection(OSectionWindow* _pParent,uno::Reference< report::XSection > _xSection) : Window(_pParent,WB_DIALOGCONTROL) - , ::comphelper::OPropertyChangeListener(m_aMutex) + , ::comphelper::OPropertyChangeListener() , DropTargetHelper(this) , m_pPage(nullptr) , m_pView(nullptr) diff --git a/reportdesign/source/ui/report/ReportWindow.cxx b/reportdesign/source/ui/report/ReportWindow.cxx index 8da0855f6146..91813270915f 100644 --- a/reportdesign/source/ui/report/ReportWindow.cxx +++ b/reportdesign/source/ui/report/ReportWindow.cxx @@ -47,7 +47,7 @@ using namespace ::comphelper; OReportWindow::OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView) : Window(_pParent,WB_DIALOGCONTROL) -, ::comphelper::OPropertyChangeListener(m_aMutex) +, ::comphelper::OPropertyChangeListener() ,m_aHRuler(VclPtr<Ruler>::Create(this)) ,m_pView(_pView) ,m_pParent(_pParent) diff --git a/reportdesign/source/ui/report/ScrollHelper.cxx b/reportdesign/source/ui/report/ScrollHelper.cxx index 491710e94ba8..ba03cc6c4ad5 100644 --- a/reportdesign/source/ui/report/ScrollHelper.cxx +++ b/reportdesign/source/ui/report/ScrollHelper.cxx @@ -44,7 +44,7 @@ static void lcl_setScrollBar(sal_Int32 _nNewValue,const Point& _aPos,const Size& OScrollWindowHelper::OScrollWindowHelper( ODesignView* _pDesignView) : OScrollWindowHelper_BASE( _pDesignView,WB_DIALOGCONTROL) - ,OPropertyChangeListener(m_aMutex) + ,OPropertyChangeListener() ,m_aHScroll( VclPtr<ScrollAdaptor>::Create(this, true) ) ,m_aVScroll( VclPtr<ScrollAdaptor>::Create(this, false) ) ,m_pParent(_pDesignView) diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx index 60d5235f84bb..74624c69662d 100644 --- a/reportdesign/source/ui/report/SectionWindow.cxx +++ b/reportdesign/source/ui/report/SectionWindow.cxx @@ -41,7 +41,7 @@ using namespace ::comphelper; OSectionWindow::OSectionWindow( OViewsWindow* _pParent,const uno::Reference< report::XSection >& _xSection,const OUString& _sColorEntry) : Window( _pParent,WB_DIALOGCONTROL) -,OPropertyChangeListener(m_aMutex) +,OPropertyChangeListener() ,m_pParent(_pParent) ,m_aStartMarker( VclPtr<rptui::OStartMarker>::Create(this,_sColorEntry)) ,m_aReportSection( VclPtr<rptui::OReportSection>::Create(this,_xSection)) diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index a8a87a8d0803..64947e7c8814 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -519,7 +519,7 @@ void DbGridColumn::ImplInitWindow( vcl::Window const & rParent, const InitWindow DbCellControl::DbCellControl( DbGridColumn& _rColumn ) - :OPropertyChangeListener(m_aMutex) + :OPropertyChangeListener() ,m_bTransparent( false ) ,m_bAlignedController( true ) ,m_bAccessingValueProperty( false ) diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index b6fb24d05df7..b891f2081a04 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -143,7 +143,7 @@ public: }; GridFieldValueListener::GridFieldValueListener(DbGridControl& _rParent, const Reference< XPropertySet >& _rField, sal_uInt16 _nId) - :OPropertyChangeListener(m_aMutex) + :OPropertyChangeListener() ,m_rParent(_rParent) ,m_nId(_nId) ,m_nSuspended(0) @@ -254,7 +254,7 @@ public: }; FmXGridSourcePropListener::FmXGridSourcePropListener(DbGridControl* _pParent) - :OPropertyChangeListener(m_aMutex) + :OPropertyChangeListener() ,m_pParent(_pParent) ,m_nSuspended(0) { |