Bug 158664 - [Linux only] Crash when deleting or adding a slide after presenting with presenter console visible
Summary: [Linux only] Crash when deleting or adding a slide after presenting with pres...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha1+
Hardware: x86-64 (AMD64) Linux (All)
: medium critical
Assignee: Armin Le Grand
URL: https://crashreport.libreoffice.org/s...
Whiteboard: target:24.8.0 target:24.2.0.3
Keywords: bibisected, bisected, haveBacktrace, regression
Depends on:
Blocks: Slide-Show Presenter-Console Crash
  Show dependency treegraph
 
Reported: 2023-12-12 14:09 UTC by Stéphane Guillou (stragu)
Modified: 2024-01-24 15:56 UTC (History)
1 user (show)

See Also:
Crash report or crash signature: ["<name omitted>"]


Attachments
bt with debug symbols (4.20 KB, text/plain)
2023-12-12 20:31 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stéphane Guillou (stragu) 2023-12-12 14:09:47 UTC
Steps:
1. Open Impress
2. If only using one monitor: Slide Show > Slide Show Settings > Display > Presenter Console > Windowed > OK (otherwise, Presenter Console won't be shown)
3. Slide Show > Start from first slide
4. Close slide show
5. Add a slide with a double-click in the Slide pane, or with Ctrl + M, or with Slide > New Slide. (Or delete one, if there is more than one.)

Result: crash

Repro in:

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 76400f66096a5cdc64cbd72ed9a94961b3200216
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Version: 24.2.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 0ddd9f7e055a0c1ecb120de3e40c3fdb8373e9dc
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

In console:

warn:legacy.tools:1390649:1390649:sd/source/ui/view/drviews1.cxx:664: sd::DrawViewShell::getCurrentPage(), illegal page index!

No repro with gen VCL plugin.
No repro in 7.6.4.1 -> regression.

Bibisected with linux-64-24.2 bibisect repo to first bad build commit [0610b0f19139461ff2370ed34511fde491f570ae] which points to:

commit 878b4ffc3e2c80c7f65b75c35fea26b978b71daf
author	Armin Le Grand (allotropia) 	Fri Nov 24 16:02:17 2023 +0100
committer	Armin Le Grand 	Tue Nov 28 11:52:04 2023 +0100
Update SlideShow on DrawModel changes II
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159930

Armin, can you please have a look?
Will get a backtrace when I've got a recent debug build.
Comment 1 Julien Nabet 2023-12-12 20:31:22 UTC
Created attachment 191398 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today, I could reproduce this.
Comment 2 Matt K 2023-12-13 05:09:51 UTC
(In reply to Julien Nabet from comment #1)
> On pc Debian x86-64 with master sources updated today, I could reproduce
> this.

I could not repro this on Windows 11 with:

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 9382734da1838485bfe7d2ae912b8d61f24231e4
CPU threads: 16; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded
Comment 3 Armin Le Grand 2024-01-11 10:39:57 UTC
Taking a look...
Comment 4 Armin Le Grand 2024-01-11 11:33:19 UTC
Could reproduce without problems, thanks for the description!

I am surprised, but it looks like presentation::XPresentation at the SdXImpressDocument is *kept* after ending the Slideshow, so re-used. I did not know that (but what do I know about the office...).

Interstingly,
  SlideshowImpl::deactivate()
  SlideshowImpl::activate()
gets called at focus change when switching to the EditView.

It gets disposed, though, checking what to do/call to react...
Comment 5 Armin Le Grand 2024-01-11 13:15:47 UTC
Hmmm.. SlideshowImpl::disposing() already calls removeAsSlideShowListener(), so I have to check why still events come up with the slideshow down.
Thus mxView which is rtl::Reference<sd::SlideShowView> gets disposed, but SlideshowImpl stays at it seems. sd::SlideShowView uses SlideshowImpl.
CAUTION: There are TWO SlideShowImpl, one in slideshow/source/engine/slideshowimpl.cxx and one in sd/source/ui/slideshow/slideshowimpl.cxx...
Comment 6 Armin Le Grand 2024-01-11 13:22:15 UTC
I could change the calls in SlideshowImpl (the one in sd/source/ui/slideshow/slideshowimpl.cxx) to
        StartListening(*mpDoc);
        EndListening(*mpDoc);
to get done when SlideSHow activates/deactivates, but that may miss possible call combinations. So I decided to just add
    if (!isRunning())
        // no SlideShow instance or not running, nothing to do
        return;
to SlideshowImpl::Notify to ignore notifications when Slideshow is not running. Works and seems safe.
Comment 7 Armin Le Grand 2024-01-11 13:25:31 UTC
Solution on https://gerrit.libreoffice.org/c/core/+/161922
Comment 8 Commit Notification 2024-01-11 17:13:43 UTC
Armin Le Grand (allotropia) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2184890a0eebc55aa24cbe61de5b8918d958c65f

tdf#158664 Ignore Notifications when SlideShow is inactive

It will be available in 24.8.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 9 Commit Notification 2024-01-12 10:33:36 UTC
Armin Le Grand (allotropia) committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

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

tdf#158664 Ignore Notifications when SlideShow is inactive

It will be available in 24.2.1.

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 10 Armin Le Grand 2024-01-15 17:59:38 UTC
Should be done.
Comment 11 Stéphane Guillou (stragu) 2024-01-18 22:21:03 UTC
Fix verified in:

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 8b393bba91111bd4f8988457f3a78b0306462bf2
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Thanks Armin!
Comment 12 Commit Notification 2024-01-24 08:51:16 UTC
Armin Le Grand (allotropia) committed a patch related to this issue.
It has been pushed to "libreoffice-24-2-0":

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

tdf#158664 Ignore Notifications when SlideShow is inactive

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.