diff options
author | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-01-30 01:58:08 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-01-30 13:17:51 +0100 |
commit | 8bda331afdbdfe42ae519d325014dd4fa9ef9ec2 (patch) | |
tree | c679d51f88367ae75adc6cd4ac02f6068e712fb4 /sfx2 | |
parent | 9427ab79de3824b8b3edc692c992fa29e5b3cbed (diff) |
tdf#115090 prevent SfxBaseModel destruction during notifications
Additionally ensure refcount stays above sea level while notifying
clients (who might dispose their own references, causing our own
refcount to drop to zero). Otherwise, 2nd loop in postEvent_Impl()
might already operate on freed mem.
Change-Id: Ie06de9ea33f7e2e334e0ef39d13c50009261791e
Reviewed-on: https://gerrit.libreoffice.org/48871
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index d57fe3435f85..9987acf9b5db 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3062,9 +3062,12 @@ void SfxBaseModel::postEvent_Impl( const OUString& aName, const Reference< frame if ( impl_isDisposed() ) return; - // keep m_pData alive, if notified target would close the document + // keep m_pData alive, if notified target would dispose the document std::shared_ptr<IMPL_SfxBaseModel_DataContainer> pData(m_pData); + // also make sure this object doesn't self-destruct while notifying + rtl::Reference<SfxBaseModel> self(this); + DBG_ASSERT( !aName.isEmpty(), "Empty event name!" ); if (aName.isEmpty()) return; |