diff options
author | Noel Grandin <noel@peralex.com> | 2016-06-01 16:22:29 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-06 07:01:34 +0000 |
commit | 0323253a7c67316cb96e4a64792ab4fe74aac1ca (patch) | |
tree | 81787c4ae44ff778aa41e12574cd60a624c9277b /sc/source/ui/unoobj | |
parent | 4d666f5092d7c4f2ece9702dda4d874e44cdc6f7 (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sc/source/ui/unoobj')
-rw-r--r-- | sc/source/ui/unoobj/datauno.cxx | 46 |
1 files changed, 17 insertions, 29 deletions
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index bad58331f6a6..dc3f64485b30 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -806,28 +806,24 @@ void ScSubTotalDescriptor::SetParam( const ScSubTotalParam& rNew ) } ScRangeSubTotalDescriptor::ScRangeSubTotalDescriptor(ScDatabaseRangeObj* pPar) : - pParent(pPar) + mxParent(pPar) { - if (pParent) - pParent->acquire(); } ScRangeSubTotalDescriptor::~ScRangeSubTotalDescriptor() { - if (pParent) - pParent->release(); } void ScRangeSubTotalDescriptor::GetData( ScSubTotalParam& rParam ) const { - if (pParent) - pParent->GetSubTotalParam( rParam ); + if (mxParent.is()) + mxParent->GetSubTotalParam( rParam ); } void ScRangeSubTotalDescriptor::PutData( const ScSubTotalParam& rParam ) { - if (pParent) - pParent->SetSubTotalParam( rParam ); + if (mxParent.is()) + mxParent->SetSubTotalParam( rParam ); } ScConsolidationDescriptor::ScConsolidationDescriptor() @@ -1544,49 +1540,41 @@ void ScFilterDescriptor::SetParam( const ScQueryParam& rNew ) ScRangeFilterDescriptor::ScRangeFilterDescriptor(ScDocShell* pDocShell, ScDatabaseRangeObj* pPar) : ScFilterDescriptorBase(pDocShell), - pParent(pPar) + mxParent(pPar) { - if (pParent) - pParent->acquire(); } ScRangeFilterDescriptor::~ScRangeFilterDescriptor() { - if (pParent) - pParent->release(); } void ScRangeFilterDescriptor::GetData( ScQueryParam& rParam ) const { - if (pParent) - pParent->GetQueryParam( rParam ); + if (mxParent.is()) + mxParent->GetQueryParam( rParam ); } void ScRangeFilterDescriptor::PutData( const ScQueryParam& rParam ) { - if (pParent) - pParent->SetQueryParam( rParam ); + if (mxParent.is()) + mxParent->SetQueryParam( rParam ); } ScDataPilotFilterDescriptor::ScDataPilotFilterDescriptor(ScDocShell* pDocShell, ScDataPilotDescriptorBase* pPar) : ScFilterDescriptorBase(pDocShell), - pParent(pPar) + mxParent(pPar) { - if (pParent) - pParent->acquire(); } ScDataPilotFilterDescriptor::~ScDataPilotFilterDescriptor() { - if (pParent) - pParent->release(); } void ScDataPilotFilterDescriptor::GetData( ScQueryParam& rParam ) const { - if (pParent) + if (mxParent.is()) { - ScDPObject* pDPObj = pParent->GetDPObject(); + ScDPObject* pDPObj = mxParent->GetDPObject(); if (pDPObj && pDPObj->IsSheetData()) rParam = pDPObj->GetSheetDesc()->GetQueryParam(); } @@ -1594,17 +1582,17 @@ void ScDataPilotFilterDescriptor::GetData( ScQueryParam& rParam ) const void ScDataPilotFilterDescriptor::PutData( const ScQueryParam& rParam ) { - if (pParent) + if (mxParent.is()) { - ScDPObject* pDPObj = pParent->GetDPObject(); + ScDPObject* pDPObj = mxParent->GetDPObject(); if (pDPObj) { - ScSheetSourceDesc aSheetDesc(&pParent->GetDocShell()->GetDocument()); + ScSheetSourceDesc aSheetDesc(&mxParent->GetDocShell()->GetDocument()); if (pDPObj->IsSheetData()) aSheetDesc = *pDPObj->GetSheetDesc(); aSheetDesc.SetQueryParam(rParam); pDPObj->SetSheetDesc(aSheetDesc); - pParent->SetDPObject(pDPObj); + mxParent->SetDPObject(pDPObj); } } } |