From 5dd00fedb49f86564f93f07f89faabcb6fad87f6 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 7 Jun 2016 11:20:50 +0200 Subject: remove some manual refcounting in reportdesign Change-Id: I660b94acaf07f7ff79b787a6e7bbbcbdbeae0ac0 Reviewed-on: https://gerrit.libreoffice.org/26009 Tested-by: Jenkins Reviewed-by: Noel Grandin --- reportdesign/source/ui/inc/ReportController.hxx | 6 +++--- reportdesign/source/ui/report/ReportController.cxx | 18 +++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) (limited to 'reportdesign') diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx index fc8dcd9c7fb6..4082efb9766a 100644 --- a/reportdesign/source/ui/inc/ReportController.hxx +++ b/reportdesign/source/ui/inc/ReportController.hxx @@ -90,11 +90,11 @@ namespace rptui css::uno::Sequence< css::beans::PropertyValue> m_aCollapsedSections; TransferableDataHelper m_aSystemClipboard; // content of the clipboard - TransferableClipboardListener* - m_pClipbordNotifier; /// notifier for changes in the clipboard + rtl::Reference + m_pClipboardNotifier; /// notifier for changes in the clipboard VclPtr m_pGroupsFloater; - OXReportControllerObserver* m_pReportControllerObserver; + rtl::Reference m_pReportControllerObserver; ODesignView* getDesignView() const { return static_cast< ODesignView* >( getView() ); } diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index ef8531868df1..63bd2b597833 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -276,7 +276,6 @@ OReportController::OReportController(Reference< XComponentContext > const & xCon :OReportController_BASE(xContext) ,OPropertyStateContainer(OGenericUnoController_Base::rBHelper) ,m_aSelectionListeners( getMutex() ) - ,m_pClipbordNotifier(nullptr) ,m_pGroupsFloater(nullptr) ,m_sMode("normal") ,m_nSplitPos(-1) @@ -297,7 +296,6 @@ OReportController::OReportController(Reference< XComponentContext > const & xCon { // new Observer m_pReportControllerObserver = new OXReportControllerObserver(*this); - m_pReportControllerObserver->acquire(); registerProperty("ZoomValue", PROPERTY_ID_ZOOMVALUE, beans::PropertyAttribute::BOUND | beans::PropertyAttribute::TRANSIENT, &m_nZoomValue, ::cppu::UnoType::get()); @@ -314,12 +312,11 @@ IMPLEMENT_FORWARD_XINTERFACE2(OReportController,OReportController_BASE,OReportCo void OReportController::disposing() { - if ( m_pClipbordNotifier ) + if ( m_pClipboardNotifier.is() ) { - m_pClipbordNotifier->ClearCallbackLink(); - m_pClipbordNotifier->AddRemoveListener( getView(), false ); - m_pClipbordNotifier->release(); - m_pClipbordNotifier = nullptr; + m_pClipboardNotifier->ClearCallbackLink(); + m_pClipboardNotifier->AddRemoveListener( getView(), false ); + m_pClipboardNotifier.clear(); } if ( m_pGroupsFloater ) { @@ -356,7 +353,7 @@ void OReportController::disposing() if ( m_aReportModel ) listen(false); m_pReportControllerObserver->Clear(); - m_pReportControllerObserver->release(); + m_pReportControllerObserver.clear(); } catch(const uno::Exception&) { @@ -1768,9 +1765,8 @@ bool OReportController::Construct(vcl::Window* pParent) // now that we have a view we can create the clipboard listener m_aSystemClipboard = TransferableDataHelper::CreateFromSystemClipboard( getView() ); m_aSystemClipboard.StartClipboardListening( ); - m_pClipbordNotifier = new TransferableClipboardListener( LINK( this, OReportController, OnClipboardChanged ) ); - m_pClipbordNotifier->acquire(); - m_pClipbordNotifier->AddRemoveListener( getView(), true ); + m_pClipboardNotifier = new TransferableClipboardListener( LINK( this, OReportController, OnClipboardChanged ) ); + m_pClipboardNotifier->AddRemoveListener( getView(), true ); OReportController_BASE::Construct(pParent); return true; -- cgit v1.2.3