diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-16 14:07:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-17 06:42:10 +0000 |
commit | 4b668a5071b2f0bc74f62873679fba5c6c2d04ce (patch) | |
tree | e2e5ca75d7e9e933d8d54ea56a25492d27e013d0 /ucb | |
parent | 90df5ee10727719aa1407ed4d1f06d7a790d6871 (diff) |
use rtl::Reference in SortedDynamicResultSet
instead of storing both raw pointers and uno::Reference
Change-Id: Ifcc9daf95d4b2583c9bc4b06deb65a2e618ac1e0
Reviewed-on: https://gerrit.libreoffice.org/33168
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/sorter/sortdynres.cxx | 45 | ||||
-rw-r--r-- | ucb/source/sorter/sortdynres.hxx | 15 |
2 files changed, 22 insertions, 38 deletions
diff --git a/ucb/source/sorter/sortdynres.cxx b/ucb/source/sorter/sortdynres.cxx index ead0def16a28..e3dcfcc30949 100644 --- a/ucb/source/sorter/sortdynres.cxx +++ b/ucb/source/sorter/sortdynres.cxx @@ -63,18 +63,13 @@ SortedDynamicResultSet::SortedDynamicResultSet( const Reference < XComponentContext > &rxContext ) { mpDisposeEventListeners = nullptr; - mpOwnListener = new SortedDynamicResultSetListener( this ); - - mxOwnListener.set( mpOwnListener ); + mxOwnListener = new SortedDynamicResultSetListener( this ); mxOriginal = xOriginal; maOptions = aOptions; mxCompFac = xCompFac; m_xContext = rxContext; - mpOne = nullptr; - mpTwo = nullptr; - mbGotWelcome = false; mbUseOne = true; mbStatic = false; @@ -83,7 +78,7 @@ SortedDynamicResultSet::SortedDynamicResultSet( SortedDynamicResultSet::~SortedDynamicResultSet() { - mpOwnListener->impl_OwnerDies(); + mxOwnListener->impl_OwnerDies(); mxOwnListener.clear(); delete mpDisposeEventListeners; @@ -91,9 +86,6 @@ SortedDynamicResultSet::~SortedDynamicResultSet() mxOne.clear(); mxTwo.clear(); mxOriginal.clear(); - - mpOne = nullptr; - mpTwo = nullptr; } // XServiceInfo methods. @@ -134,8 +126,6 @@ void SAL_CALL SortedDynamicResultSet::dispose() mxTwo.clear(); mxOriginal.clear(); - mpOne = nullptr; - mpTwo = nullptr; mbUseOne = true; } @@ -178,12 +168,11 @@ SortedDynamicResultSet::getStaticResultSet() if ( mxOriginal.is() ) { - mpOne = new SortedResultSet( mxOriginal->getStaticResultSet() ); - mxOne = mpOne; - mpOne->Initialize( maOptions, mxCompFac ); + mxOne = new SortedResultSet( mxOriginal->getStaticResultSet() ); + mxOne->Initialize( maOptions, mxCompFac ); } - return mxOne; + return mxOne.get(); } @@ -201,7 +190,7 @@ SortedDynamicResultSet::setListener( const Reference< XDynamicResultSetListener mxListener = Listener; if ( mxOriginal.is() ) - mxOriginal->setListener( mxOwnListener ); + mxOriginal->setListener( mxOwnListener.get() ); } @@ -292,14 +281,14 @@ void SortedDynamicResultSet::impl_notify( const ListEvent& Changes ) if ( mbUseOne ) { mbUseOne = false; - mpTwo->CopyData( mpOne ); - pCurSet = mpTwo; + mxTwo->CopyData( mxOne.get() ); + pCurSet = mxTwo.get(); } else { mbUseOne = true; - mpOne->CopyData( mpTwo ); - pCurSet = mpOne; + mxOne->CopyData( mxTwo.get() ); + pCurSet = mxOne.get(); } } @@ -330,17 +319,15 @@ void SortedDynamicResultSet::impl_notify( const ListEvent& Changes ) WelcomeDynamicResultSetStruct aWelcome; if ( aAction.ActionInfo >>= aWelcome ) { - mpTwo = new SortedResultSet( aWelcome.Old ); - mxTwo = mpTwo; - mpOne = new SortedResultSet( aWelcome.New ); - mxOne = mpOne; - mpOne->Initialize( maOptions, mxCompFac ); + mxTwo = new SortedResultSet( aWelcome.Old ); + mxOne = new SortedResultSet( aWelcome.New ); + mxOne->Initialize( maOptions, mxCompFac ); mbGotWelcome = true; mbUseOne = true; - pCurSet = mpOne; + pCurSet = mxOne.get(); - aWelcome.Old = mxTwo; - aWelcome.New = mxOne; + aWelcome.Old = mxTwo.get(); + aWelcome.New = mxOne.get(); ListAction *pWelcomeAction = new ListAction; pWelcomeAction->ActionInfo <<= aWelcome; diff --git a/ucb/source/sorter/sortdynres.hxx b/ucb/source/sorter/sortdynres.hxx index a766f5f79179..85a2ec20c0d8 100644 --- a/ucb/source/sorter/sortdynres.hxx +++ b/ucb/source/sorter/sortdynres.hxx @@ -47,24 +47,21 @@ class SortedDynamicResultSet: public cppu::WeakImplHelper < comphelper::OInterfaceContainerHelper2 *mpDisposeEventListeners; css::uno::Reference < css::ucb::XDynamicResultSetListener > mxListener; - css::uno::Reference < css::ucb::XDynamicResultSetListener > mxOwnListener; - css::uno::Reference < css::sdbc::XResultSet > mxOne; - css::uno::Reference < css::sdbc::XResultSet > mxTwo; css::uno::Reference < css::ucb::XDynamicResultSet > mxOriginal; css::uno::Sequence < css::ucb::NumberedSortingInfo > maOptions; css::uno::Reference < css::ucb::XAnyCompareFactory > mxCompFac; css::uno::Reference < css::uno::XComponentContext > m_xContext; - SortedResultSet* mpOne; - SortedResultSet* mpTwo; - SortedDynamicResultSetListener* mpOwnListener; + rtl::Reference<SortedResultSet> mxOne; + rtl::Reference<SortedResultSet> mxTwo; + rtl::Reference<SortedDynamicResultSetListener> mxOwnListener; EventList maActions; osl::Mutex maMutex; - bool mbGotWelcome:1; - bool mbUseOne:1; - bool mbStatic:1; + bool mbGotWelcome:1; + bool mbUseOne:1; + bool mbStatic:1; private: void SendNotify(); |