summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2016-06-01 00:55:54 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-06-03 10:25:36 +0000
commit0216b8dc6179fad02a9cbbc99898eef81f679f4f (patch)
tree2eae20ec4eb55950dded8b5bb17c31de56415d8b /basic
parent4b917b2cfccfd8c324969793c0ea530bd9273aa5 (diff)
tdf#89329: use unique_ptr for pImpl in sbxvar
Change-Id: I74734c34e72ba5d508830dbcff88f0d3b93a0766 Reviewed-on: https://gerrit.libreoffice.org/25742 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/sbx/sbxvar.cxx32
1 files changed, 12 insertions, 20 deletions
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 18d50540478a..1b52c46386d0 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -62,7 +62,6 @@ class SbxVariableImpl
SbxVariable::SbxVariable() : SbxValue()
{
- mpSbxVariableImpl = nullptr;
pCst = nullptr;
pParent = nullptr;
nUserData = 0;
@@ -75,14 +74,13 @@ SbxVariable::SbxVariable( const SbxVariable& r )
mpPar( r.mpPar ),
pInfo( r.pInfo )
{
- mpSbxVariableImpl = nullptr;
- if( r.mpSbxVariableImpl != nullptr )
+ if( r.mpImpl != nullptr )
{
- mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl );
+ mpImpl.reset( new SbxVariableImpl( *r.mpImpl ) );
#if HAVE_FEATURE_SCRIPTING
- if( mpSbxVariableImpl->m_xComListener.is() )
+ if( mpImpl->m_xComListener.is() )
{
- registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic );
+ registerComListenerVariableForBasic( this, mpImpl->m_pComListenerParentBasic );
}
#endif
}
@@ -104,7 +102,6 @@ SbxVariable::SbxVariable( const SbxVariable& r )
SbxVariable::SbxVariable( SbxDataType t, void* p ) : SbxValue( t, p )
{
- mpSbxVariableImpl = nullptr;
pCst = nullptr;
pParent = nullptr;
nUserData = 0;
@@ -119,7 +116,6 @@ SbxVariable::~SbxVariable()
removeDimAsNewRecoverItem( this );
}
#endif
- delete mpSbxVariableImpl;
delete pCst;
}
@@ -349,21 +345,17 @@ sal_uInt16 SbxVariable::MakeHashCode( const OUString& rName )
SbxVariable& SbxVariable::operator=( const SbxVariable& r )
{
SbxValue::operator=( r );
- delete mpSbxVariableImpl;
- if( r.mpSbxVariableImpl != nullptr )
+ mpImpl.reset();
+ if( r.mpImpl != nullptr )
{
- mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl );
+ mpImpl.reset( new SbxVariableImpl( *r.mpImpl ) );
#if HAVE_FEATURE_SCRIPTING
- if( mpSbxVariableImpl->m_xComListener.is() )
+ if( mpImpl->m_xComListener.is() )
{
- registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic );
+ registerComListenerVariableForBasic( this, mpImpl->m_pComListenerParentBasic );
}
#endif
}
- else
- {
- mpSbxVariableImpl = nullptr;
- }
return *this;
}
@@ -431,11 +423,11 @@ void SbxVariable::SetParent( SbxObject* p )
SbxVariableImpl* SbxVariable::getImpl()
{
- if( mpSbxVariableImpl == nullptr )
+ if(!mpImpl)
{
- mpSbxVariableImpl = new SbxVariableImpl();
+ mpImpl.reset(new SbxVariableImpl);
}
- return mpSbxVariableImpl;
+ return mpImpl.get();
}
const OUString& SbxVariable::GetDeclareClassName()