Kaydet (Commit) 1841fcf8 authored tarafından Thorsten Behrens's avatar Thorsten Behrens

tdf#115090 keep internal BaseModel alive long enough

There's reams of code already preventing a close during save
(SfxSaveGuard), but this looks equally effective. Avoids
SfxBaseModel::dispose() pulling the rug under us, when
SfxBaseModel::postEvent_Impl() wants to access parts of the
interface containers during notification.

Change-Id: Iace1f9922c47a97ab2e798b577c6aec8a729da48
Reviewed-on: https://gerrit.libreoffice.org/48709Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 498deef4
......@@ -739,7 +739,7 @@ private:
private:
std::unique_ptr<IMPL_SfxBaseModel_DataContainer> m_pData;
std::shared_ptr<IMPL_SfxBaseModel_DataContainer> m_pData;
// cannot be held in m_pData, since it needs to be accessed in non-threadsafe context
const bool m_bSupportEmbeddedScripts;
const bool m_bSupportDocRecovery;
......
......@@ -3062,6 +3062,9 @@ 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
std::shared_ptr<IMPL_SfxBaseModel_DataContainer> pData(m_pData);
DBG_ASSERT( !aName.isEmpty(), "Empty event name!" );
if (aName.isEmpty())
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment