tdf#158169 take no actions in disposed incarnation

Using the described steps in the bug report it is possible
to have an already disposed incarnation of ChildrenManagerImpl
that gets called with notifyEvent. If exposed it is necessary
not to execute actions, but to inform the caller by triggering
a lang::DisposedException(). The SfxBaseModel::notifyEvent
that executes this will then remove the instance from it's list.

Change-Id: Ie39e37d6e55ea66f441e732b612774b18d7c3ca1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159306
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
This commit is contained in:
Armin Le Grand (allotropia)
2023-11-10 20:05:11 +01:00
committed by Armin Le Grand
parent 867c4b75dd
commit 23e9a4cf1e
@@ -681,6 +681,11 @@ void SAL_CALL
ChildrenManagerImpl::notifyEvent (
const document::EventObject& rEventObject)
{
// tdf#158169 if we are already disposed, execute no actions, but inform the
// caller that we are disposed
if ( m_bDisposed )
throw lang::DisposedException();
if (rEventObject.EventName == "ShapeInserted")
AddShape (Reference<drawing::XShape>(rEventObject.Source, uno::UNO_QUERY));
else if (rEventObject.EventName == "ShapeRemoved")