From 0323253a7c67316cb96e4a64792ab4fe74aac1ca Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 1 Jun 2016 16:22:29 +0200 Subject: remove some manual ref-counting triggered when I noticed a class doing acquire() in the constructor and then release() in the destructor. found mostly by git grep -n -B5 -e '->release()' Change-Id: I96e43a3d30ffd9ae9a34275f24cd914d8f7b026f Reviewed-on: https://gerrit.libreoffice.org/25806 Tested-by: Jenkins Reviewed-by: Noel Grandin --- reportdesign/inc/RptModel.hxx | 4 ++-- reportdesign/source/core/sdr/RptModel.cxx | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'reportdesign') diff --git a/reportdesign/inc/RptModel.hxx b/reportdesign/inc/RptModel.hxx index b37ed16fdec3..5992d21fcd78 100644 --- a/reportdesign/inc/RptModel.hxx +++ b/reportdesign/inc/RptModel.hxx @@ -43,7 +43,7 @@ class REPORTDESIGN_DLLPUBLIC OReportModel : public SdrModel friend class OReportPage; private: - OXUndoEnvironment* m_pUndoEnv; + rtl::Reference m_xUndoEnv; ::dbaui::DBSubComponentController* m_pController; ::reportdesign::OReportDefinition* m_pReportDefinition; @@ -63,7 +63,7 @@ public: /** @returns the numbering type that is used to format page fields in drawing shapes */ virtual SvxNumType GetPageNumType() const override; - OXUndoEnvironment& GetUndoEnv() { return *m_pUndoEnv;} + OXUndoEnvironment& GetUndoEnv() { return *m_xUndoEnv.get();} void SetModified(bool _bModified); inline dbaui::DBSubComponentController* getController() const { return m_pController; } diff --git a/reportdesign/source/core/sdr/RptModel.cxx b/reportdesign/source/core/sdr/RptModel.cxx index f4d66d113386..0358ecf64a77 100644 --- a/reportdesign/source/core/sdr/RptModel.cxx +++ b/reportdesign/source/core/sdr/RptModel.cxx @@ -50,8 +50,7 @@ OReportModel::OReportModel(::reportdesign::OReportDefinition* _pReportDefinition ,m_pController(nullptr) ,m_pReportDefinition(_pReportDefinition) { - m_pUndoEnv = new OXUndoEnvironment(*this); - m_pUndoEnv->acquire(); + m_xUndoEnv = new OXUndoEnvironment(*this); SetSdrUndoFactory(new OReportUndoFactory); } @@ -59,16 +58,15 @@ OReportModel::OReportModel(::reportdesign::OReportDefinition* _pReportDefinition OReportModel::~OReportModel() { detachController(); - m_pUndoEnv->release(); } void OReportModel::detachController() { m_pReportDefinition = nullptr; m_pController = nullptr; - m_pUndoEnv->EndListening( *this ); + m_xUndoEnv->EndListening( *this ); ClearUndoBuffer(); - m_pUndoEnv->Clear(OXUndoEnvironment::Accessor()); + m_xUndoEnv->Clear(OXUndoEnvironment::Accessor()); } SdrPage* OReportModel::AllocPage(bool /*bMasterPage*/) @@ -102,7 +100,7 @@ OReportPage* OReportModel::createNewPage(const uno::Reference< report::XSection SolarMutexGuard aSolarGuard; OReportPage* pPage = new OReportPage( *this ,_xSection); InsertPage(pPage); - m_pUndoEnv->AddSection(_xSection); + m_xUndoEnv->AddSection(_xSection); return pPage; } -- cgit v1.2.3