diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-10 14:14:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-10 15:14:48 +0200 |
commit | 0afb2b63b38dff138e66f4ac8afed60911cb6aad (patch) | |
tree | 6f0d5e837600a460a57fce6383bc4eef10cdfc7a /basic/source/runtime | |
parent | b3541dea4889b9d0039554f87bd16e55189cf8b1 (diff) |
fix some leaks in basic
Change-Id: I52c10cdbe9661974c908ee052336c779a40de402
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115323
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic/source/runtime')
-rw-r--r-- | basic/source/runtime/runtime.cxx | 22 | ||||
-rw-r--r-- | basic/source/runtime/stdobj1.cxx | 2 |
2 files changed, 12 insertions, 12 deletions
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index d1dcd3d74502..b82cf7b5f8a1 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -598,7 +598,7 @@ SbMethod* SbiInstance::GetCaller( sal_uInt16 nLevel ) SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, sal_uInt32 nStart ) : rBasic( *static_cast<StarBASIC*>(pm->pParent) ), pInst( GetSbData()->pInst ), - pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), mpExtCaller(nullptr), m_nLastTime(0) + pMod( pm ), pMeth( pe ), pImg( pMod->pImage.get() ), mpExtCaller(nullptr), m_nLastTime(0) { nFlags = pe ? pe->GetDebugFlags() : BasicDebugFlags::NONE; pIosys = pInst->GetIoSystem(); @@ -4382,7 +4382,7 @@ void SbiRuntime::StepOPEN( sal_uInt32 nOp1, sal_uInt32 nOp2 ) void SbiRuntime::StepCREATE( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { OUString aClass( pImg->GetString( static_cast<short>( nOp2 ) ) ); - SbxObject *pObj = SbxBase::CreateObject( aClass ); + SbxObjectRef pObj = SbxBase::CreateObject( aClass ); if( !pObj ) { Error( ERRCODE_BASIC_INVALID_OBJECT ); @@ -4393,9 +4393,9 @@ void SbiRuntime::StepCREATE( sal_uInt32 nOp1, sal_uInt32 nOp2 ) pObj->SetName( aName ); // the object must be able to call the BASIC pObj->SetParent( &rBasic ); - SbxVariable* pNew = new SbxVariable; - pNew->PutObject( pObj ); - PushVar( pNew ); + SbxVariableRef pNew = new SbxVariable; + pNew->PutObject( pObj.get() ); + PushVar( pNew.get() ); } } @@ -4457,7 +4457,7 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { if (!bRestored || !pArray->SbxArray::GetRef(i)) // For those left unset after preserve { - SbxObject* pClassObj = SbxBase::CreateObject(aClass); + SbxObjectRef pClassObj = SbxBase::CreateObject(aClass); if (!pClassObj) { Error(ERRCODE_BASIC_INVALID_OBJECT); @@ -4470,7 +4470,7 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 ) pClassObj->SetName(aName); // the object must be able to call the basic pClassObj->SetParent(&rBasic); - pArray->SbxArray::Put(pClassObj, i); + pArray->SbxArray::Put(pClassObj.get(), i); } } } @@ -4481,15 +4481,15 @@ void SbiRuntime::StepTCREATE( sal_uInt32 nOp1, sal_uInt32 nOp2 ) OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) ); OUString aClass( pImg->GetString( static_cast<short>( nOp2 ) ) ); - SbxObject* pCopyObj = createUserTypeImpl( aClass ); + SbxObjectRef pCopyObj = createUserTypeImpl( aClass ); if( pCopyObj ) { pCopyObj->SetName( aName ); } - SbxVariable* pNew = new SbxVariable; - pNew->PutObject( pCopyObj ); + SbxVariableRef pNew = new SbxVariable; + pNew->PutObject( pCopyObj.get() ); pNew->SetDeclareClassName( aClass ); - PushVar( pNew ); + PushVar( pNew.get() ); } void SbiRuntime::implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt32 nOp2 ) diff --git a/basic/source/runtime/stdobj1.cxx b/basic/source/runtime/stdobj1.cxx index d5237b6f9e8c..ee7df8d7a62d 100644 --- a/basic/source/runtime/stdobj1.cxx +++ b/basic/source/runtime/stdobj1.cxx @@ -44,7 +44,7 @@ SbStdFactory::SbStdFactory() { } -SbxObject* SbStdFactory::CreateObject( const OUString& rClassName ) +SbxObjectRef SbStdFactory::CreateObject( const OUString& rClassName ) { if( rClassName.equalsIgnoreAsciiCase("Picture") ) return new SbStdPicture; |