Bug 158169

Summary: Crash when using multiple Views
Product: LibreOffice Reporter: Armin Le Grand <Armin.Le.Grand>
Component: ImpressAssignee: Armin Le Grand <Armin.Le.Grand>
Status: RESOLVED FIXED    
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard: target:24.2.0 target:7.6.4
Crash report or crash signature: Regression By:

Description Armin Le Grand 2023-11-10 16:47:28 UTC
To reproduce:
- New Impress
- Menu: Window/New Window
- In new View change to 'Notes' View
- In old View insert an Object (e.g. 'Ellipse')
-> Lo crashes
Comment 1 Armin Le Grand 2023-11-10 16:58:51 UTC
Looking into it...

Has to do with ChildrenManagerImpl: An already disposed one is used by ChildrenManagerImpl::AddShape getting called.
That ChildrenManagerImpl gets already disposed when the 2nd View gets changed to 'Notes' (by ChildrenManagerImpl::impl_dispose() getting called), but it gets not removed from the notify mechanism.
This gets triggered by SfxBaseModel::notifyEvent due to the disposed ChildrenManagerImpl being member of m_pData->m_aDocumentEventListeners1. This method already expects RuntimeException(s) and removes the listener in that case.
That shows what to do: throw lang::DisposedException() if incarnation is disposed (we have m_bDisposed from the base class comphelper::UnoImplBase to know that).
Adding this to ChildrenManagerImpl::notifyEvent solves the problem for AddShape/RemoveShape.
NOTE: More member functions of ChildrenManagerImpl may need this.
Comment 2 Commit Notification 2023-11-10 19:06:11 UTC
Armin Le Grand (allotropia) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/23e9a4cf1eec75cdd40a695ecae2af9b952178d3

tdf#158169 take no actions in disposed incarnation

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Commit Notification 2023-11-12 00:40:50 UTC
Armin Le Grand (allotropia) committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/e168e20b519885789cfafbb7d4726d5c79bd2aac

tdf#158169 take no actions in disposed incarnation

It will be available in 7.6.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.