Bug 158686 - FILEOPEN RTF Crash when changing to print preview
Summary: FILEOPEN RTF Crash when changing to print preview
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:24.8.0 target:24.2.0.0.beta2 t...
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2023-12-13 13:46 UTC by Gabor Kelemen (allotropia)
Modified: 2023-12-22 09:10 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2023-12-13 13:46:51 UTC
When attachment 191094 [details] from bug 153193 is opened in Writer then switched to print preview mode, Writer crashes.

1. Open Options - Writer - Formatting Aids
2. Enable Hidden Characters (without this, below steps work)
3. Open attachment 191094 [details] 
4. On the toolbar press the Print Preview button
-> crash

Seems to have started in:

https://git.libreoffice.org/core/+/b8521d969ab5be4fc947e467d4afe969f9d3b563

author	Miklos Vajna <vmiklos@collabora.com>	Mon Sep 25 08:38:28 2023 +0200
committer	Miklos Vajna <vmiklos@collabora.com>	Mon Sep 25 09:41:41 2023 +0200
tree b8c80fb5cc0debcf3b4144cb147bae13c671a493
parent 6acdde8006e6b59758b00bc178f15f32796a1987 [diff]

tdf#157263 sw floattable: prefer join over split after moving fwd
Comment 1 Gabor Kelemen (allotropia) 2023-12-13 13:48:22 UTC
Happens in a fresh nightly:

Version: 24.2.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 0ddd9f7e055a0c1ecb120de3e40c3fdb8373e9dc
CPU threads: 15; OS: Windows 10.0 Build 19045; UI render: default; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: threaded

Adding CC to: Miklos Vajna
Comment 2 Miklos Vajna 2023-12-13 15:27:48 UTC
Yes, I can reproduce this.
Comment 3 Julien Nabet 2023-12-13 16:36:41 UTC
Just for the record, on pc Debian x86-64 with master sources updated today I don't reproduce this (with gen or gtk3 renderings).
(I confirm I enabled Hidden Characters in Options - Writer - Formatting Aids)
Since Miklos reproduced this, I supposed I missed something unless it's a Windows only bug.
Comment 4 Miklos Vajna 2023-12-14 07:25:15 UTC
It happened for me on Linux with gtk3. I'll try to find a fix; failing that I'll post more info here (backtrace, etc).
Comment 5 Miklos Vajna 2023-12-15 07:41:53 UTC
The backtrace I see is:

#0  std::__uniq_ptr_impl<svx::FmTextControlShell, std::default_delete<svx::FmTextControlShell> >::_M_ptr() const (this=0x6666666600000278) at /usr/include/c++/12/bits/unique_ptr.h:191
#1  0x00007ffff1813a2a in std::unique_ptr<svx::FmTextControlShell, std::default_delete<svx::FmTextControlShell> >::get() const (this=0x6666666600000278)
    at /usr/include/c++/12/bits/unique_ptr.h:462
#2  0x00007ffff180c038 in std::unique_ptr<svx::FmTextControlShell, std::default_delete<svx::FmTextControlShell> >::operator->() const (this=0x6666666600000278)
    at /usr/include/c++/12/bits/unique_ptr.h:455
#3  0x00007ffff1806cb4 in FmXFormShell::IsActiveControl_Lock(bool) const (this=0x6666666600000000, _bCountRichTextOnly=false)
    at /home/vmiklos/git/libreoffice/core/svx/source/form/fmshimp.cxx:3840
#4  0x00007ffff17e0047 in FmFormShell::IsActiveControl() const (this=0x5166ee0) at /home/vmiklos/git/libreoffice/core/svx/source/form/fmshell.cxx:1227
#5  0x00007fffd276a5c4 in SwView::SelectShell() (this=0x4e282e0) at /home/vmiklos/git/libreoffice/core/sw/source/uibase/uiview/view.cxx:296

I.e. SwView::SelectShell() dereferences its m_pFormShell pointer, but sanitizers say that it's already deleted earlier in SfxDispatcher::FlushImpl(). Need to find a way so that the dying FmFormShell notifies SwView, so the view cal clear its form shell pointer before it becomes invalid.
Comment 6 Commit Notification 2023-12-18 17:14:33 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/164fb25f7b2db7d833d6d0f28e49c5cac68426b3

tdf#158686 sw floattable: fix print preview crash

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 7 Commit Notification 2023-12-19 07:21:08 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

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

tdf#158686 sw floattable: fix print preview crash

It will be available in 24.2.0.0.beta2.

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 8 Commit Notification 2023-12-22 09:10:45 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/1f4e1b84722c4387f65614ad7f1765dcddb8aeb9

tdf#158686 sw floattable: fix print preview crash

It will be available in 7.6.5.

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.