diff options
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/classes/sb.cxx | 5 | ||||
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 20 |
2 files changed, 7 insertions, 18 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 9720031dfc1a..1f1714fe7377 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -612,7 +612,6 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) aOUSource = pClassModule->aOUSource; aComment = pClassModule->aComment; pImage = pClassModule->pImage; - // see comment in destructor about this pBreaks = pClassModule->pBreaks; SetClassName( pClassModule->GetName() ); @@ -755,10 +754,6 @@ SbClassModuleObject::~SbClassModuleObject() if( const DocBasicItem* pDocBasicItem = lclFindDocBasicItem( pDocBasic ) ) if( !pDocBasicItem->isDocClosed() ) triggerTerminateEvent(); - - // prevent the base class destructor from deleting this because - // we do not actually own it - pBreaks = nullptr; } void SbClassModuleObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 95d751bb0202..81faaaa05f1f 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -417,8 +417,8 @@ static bool getDefaultVBAMode( StarBASIC* pb ) // could be found from other module. SbModule::SbModule( const OUString& rName, bool bVBASupport ) - : SbxObject( u"StarBASICModule"_ustr ), - pBreaks(nullptr), mbVBASupport(bVBASupport), mbCompat(bVBASupport), bIsProxyModule(false) + : SbxObject( u"StarBASICModule"_ustr ) + , mbVBASupport(bVBASupport), mbCompat(bVBASupport), bIsProxyModule(false) { SetName( rName ); SetFlag( SbxFlagBits::ExtSearch | SbxFlagBits::GlobalSearch ); @@ -436,7 +436,7 @@ SbModule::~SbModule() { SAL_INFO("basic","Module named " << GetName() << " is destructing"); pImage.reset(); - delete pBreaks; + pBreaks.reset(); pClassData.reset(); mxWrapper = nullptr; } @@ -1525,7 +1525,7 @@ bool SbModule::SetBP( sal_uInt16 nLine ) if( !IsBreakable( nLine ) ) return false; if( !pBreaks ) - pBreaks = new SbiBreakpoints; + pBreaks.reset(new SbiBreakpoints); auto it = std::find_if(pBreaks->begin(), pBreaks->end(), [&nLine](const sal_uInt16 b) { return b <= nLine; }); if (it != pBreaks->end() && *it == nLine) @@ -1548,22 +1548,16 @@ bool SbModule::ClearBP( sal_uInt16 nLine ) [&nLine](const sal_uInt16 b) { return b <= nLine; }); bRes = (it != pBreaks->end()) && (*it == nLine); if (bRes) - { pBreaks->erase(it); - } - if( pBreaks->empty() ) - { - delete pBreaks; - pBreaks = nullptr; - } + if (pBreaks->empty()) + pBreaks.reset(); } return bRes; } void SbModule::ClearAllBP() { - delete pBreaks; - pBreaks = nullptr; + pBreaks.reset(); } void |