diff options
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 13 | ||||
-rw-r--r-- | basic/source/sbx/sbxvar.cxx | 19 | ||||
-rw-r--r-- | include/basic/sbxvar.hxx | 4 |
3 files changed, 15 insertions, 21 deletions
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index de486209750a..f0ee0f7f7f56 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -2080,7 +2080,7 @@ ErrCode SbMethod::Call( SbxValue* pRet, SbxVariable* pCaller ) // #100883 Own Broadcast for SbMethod void SbMethod::Broadcast( SfxHintId nHintId ) { - if( pCst && !IsSet( SbxFlagBits::NoBroadcast ) ) + if( mpBroadcaster && !IsSet( SbxFlagBits::NoBroadcast ) ) { // Because the method could be called from outside, test here once again // the authorisation @@ -2095,8 +2095,7 @@ void SbMethod::Broadcast( SfxHintId nHintId ) pMod->Compile(); // Block broadcasts while creating new method - SfxBroadcaster* pSave = pCst; - pCst = nullptr; + std::unique_ptr<SfxBroadcaster> pSaveBroadcaster = std::move(mpBroadcaster); SbMethod* pThisCopy = new SbMethod( *this ); SbMethodRef xHolder = pThisCopy; if( mpPar.is() ) @@ -2108,14 +2107,14 @@ void SbMethod::Broadcast( SfxHintId nHintId ) SetParameters( nullptr ); } - pCst = pSave; - pSave->Broadcast( SbxHint( nHintId, pThisCopy ) ); + mpBroadcaster = std::move(pSaveBroadcaster); + mpBroadcaster->Broadcast( SbxHint( nHintId, pThisCopy ) ); SbxFlagBits nSaveFlags = GetFlags(); SetFlag( SbxFlagBits::ReadWrite ); - pCst = nullptr; + pSaveBroadcaster = std::move(mpBroadcaster); Put( pThisCopy->GetValues_Impl() ); - pCst = pSave; + mpBroadcaster = std::move(pSaveBroadcaster); SetFlags( nSaveFlags ); } } diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 17db37db5c37..30088e0746f9 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -56,7 +56,6 @@ class SbxVariableImpl SbxVariable::SbxVariable() : SbxValue() { - pCst = nullptr; pParent = nullptr; nUserData = 0; nHash = 0; @@ -78,7 +77,6 @@ SbxVariable::SbxVariable( const SbxVariable& r ) } #endif } - pCst = nullptr; if( r.CanRead() ) { pParent = r.pParent; @@ -111,7 +109,6 @@ void SbxEnsureParentVariable::SetParent(SbxObject* p) SbxVariable::SbxVariable( SbxDataType t ) : SbxValue( t ) { - pCst = nullptr; pParent = nullptr; nUserData = 0; nHash = 0; @@ -125,18 +122,18 @@ SbxVariable::~SbxVariable() removeDimAsNewRecoverItem( this ); } #endif - delete pCst; + mpBroadcaster.reset(); } // Broadcasting SfxBroadcaster& SbxVariable::GetBroadcaster() { - if( !pCst ) + if( !mpBroadcaster ) { - pCst = new SfxBroadcaster; + mpBroadcaster.reset( new SfxBroadcaster ); } - return *pCst; + return *mpBroadcaster; } SbxArray* SbxVariable::GetParameters() const @@ -150,7 +147,7 @@ SbxArray* SbxVariable::GetParameters() const void SbxVariable::Broadcast( SfxHintId nHintId ) { - if( pCst && !IsSet( SbxFlagBits::NoBroadcast ) ) + if( mpBroadcaster && !IsSet( SbxFlagBits::NoBroadcast ) ) { // Because the method could be called from outside, check the // rights here again @@ -174,8 +171,7 @@ void SbxVariable::Broadcast( SfxHintId nHintId ) SbxVariableRef aBroadcastGuard(this); // Avoid further broadcasting - SfxBroadcaster* pSave = pCst; - pCst = nullptr; + std::unique_ptr<SfxBroadcaster> pSave = std::move(mpBroadcaster); SbxFlagBits nSaveFlags = GetFlags(); SetFlag( SbxFlagBits::ReadWrite ); if( mpPar.is() ) @@ -184,8 +180,7 @@ void SbxVariable::Broadcast( SfxHintId nHintId ) mpPar->GetRef( 0 ) = this; } pSave->Broadcast( SbxHint( nHintId, this ) ); - delete pCst; // who knows already, onto which thoughts someone comes? - pCst = pSave; + mpBroadcaster = std::move(pSave); SetFlags( nSaveFlags ); } } diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx index f90dc939b768..b189d4e32c26 100644 --- a/include/basic/sbxvar.hxx +++ b/include/basic/sbxvar.hxx @@ -224,7 +224,7 @@ class BASIC_DLLPUBLIC SbxVariable : public SbxValue friend class SbMethod; std::unique_ptr<SbxVariableImpl> mpImpl; // Impl data - SfxBroadcaster* pCst; // Broadcaster, if needed + std::unique_ptr<SfxBroadcaster> mpBroadcaster; // Broadcaster, if needed OUString maName; // Name, if available SbxArrayRef mpPar; // Parameter-Array, if set sal_uInt16 nHash; // Hash-ID for search @@ -268,7 +268,7 @@ public: // Sfx-Broadcasting-Support: // Due to data reduction and better DLL-hierarchy currently via casting SfxBroadcaster& GetBroadcaster(); - bool IsBroadcaster() const { return pCst != nullptr; } + bool IsBroadcaster() const { return mpBroadcaster != nullptr; } virtual void Broadcast( SfxHintId nHintId ) override; const SbxObject* GetParent() const { return pParent; } |