sfx2/source/doc/sfxbasemodel.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
New commits: commit 79e8f18f635dfd094485ed18166fd8b04c37862c Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Jan 9 16:44:50 2024 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Jan 9 17:43:18 2024 +0100 sfx2: reorder the checks in SfxBaseModel::postEvent_Impl() It doesn't make sense to copy m_pData after impl_isDisposed() checks if it's null (not sure if this makes a difference in practice). Change-Id: I5c6db0bd3e09f92acef346115a4fee44ae4c0a89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161835 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 985af531358d..a996259f3598 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3303,18 +3303,19 @@ public: void SfxBaseModel::postEvent_Impl( const OUString& aName, const Reference< frame::XController2 >& xController, const Any& supplement ) { - // object already disposed? - if ( impl_isDisposed() ) + if (aName.isEmpty()) + { + SAL_WARN("sfx.doc", "postEvent_Impl: Empty event name!"); return; - - // keep m_pData alive, if notified target would dispose the document - std::shared_ptr<IMPL_SfxBaseModel_DataContainer> xKeepAlive(m_pData); + } // also make sure this object doesn't self-destruct while notifying rtl::Reference<SfxBaseModel> xHoldAlive(this); + // keep m_pData alive, if notified target would dispose the document + std::shared_ptr<IMPL_SfxBaseModel_DataContainer> xKeepAlive(m_pData); - DBG_ASSERT( !aName.isEmpty(), "Empty event name!" ); - if (aName.isEmpty()) + // object already disposed? + if ( impl_isDisposed() ) return; if ( xKeepAlive->m_aDocumentEventListeners2.getLength() ) @@ -3340,7 +3341,6 @@ void SfxBaseModel::postEvent_Impl( const OUString& aName, const Reference< frame &document::XEventListener::notifyEvent, aEvent ) ); } - } Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData()