Bug 160801 - Writer crash when use clear formatting after insert page break (macOS only)
Summary: Writer crash when use clear formatting after insert page break (macOS only)
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.2.2 release
Hardware: All macOS (All)
: medium critical
Assignee: Patrick (volunteer)
URL:
Whiteboard: target:25.2.0 target:24.2.5 target:24...
Keywords: wantBacktrace
Depends on:
Blocks: Crash
  Show dependency treegraph
 
Reported: 2024-04-24 07:37 UTC by vika
Modified: 2024-06-13 04:06 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
example of a file (text is in Slovene) (12.04 KB, application/vnd.oasis.opendocument.text)
2024-04-24 07:40 UTC, vika
Details
Example file (8.73 KB, application/vnd.oasis.opendocument.text)
2024-05-23 07:49 UTC, Telesto
Details
Crash log after performing steps in comment #8 of this bug (114.26 KB, text/plain)
2024-05-30 23:06 UTC, Patrick (volunteer)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vika 2024-04-24 07:37:33 UTC
Description:
I have a Table of Content and headings with outline numbers. Heading are formatted with page break before. I insert a page staying with a cursor after a heading number. It is normally that in a new page paragraph style is Heading 1. I try to clear formatting what cause the program crash.
I found that if I use Default paragraph style Writer does not crash. The same if do not use heading numbers.

Steps to Reproduce:
1.insert page break before a numbered Heading 1
2.clear formatting in a new page (I do not like that style Heading 1 is used)


Actual Results:
Writer crashed. If I use Default paragraph style instead of Clear formatting, it does not crash. It also not crash if the headings are not numbered. 

Expected Results:
Clear formatting should work.


Reproducible: Always


User Profile Reset: No

Additional Info:
The style of heading formatting (numbers, outline numbers, dots..) does not matter.
Comment 1 vika 2024-04-24 07:40:18 UTC
Created attachment 193831 [details]
example of a file (text is in Slovene)

Translation: Naslov = Heading, Kazalo vsebine = Table of Content; text is dummy text.
Comment 2 Dieter 2024-05-09 10:22:41 UTC
(In reply to vika from comment #0)
> Steps to Reproduce:
> 1.insert page break before a numbered Heading 1
> 2.clear formatting in a new page (I do not like that style Heading 1 is used)

I don't get a crash with

Version: 24.2.3.2 (X86_64) / LibreOffice Community
Build ID: 433d9c2ded56988e8a90e6b2e771ee4e6a5ab2ba
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL threaded

So perhaps only a Mac issue. But please your steps of "clear formatting"
=> NEEDINFO
Comment 3 vika 2024-05-09 11:23:22 UTC
It is true. I have tested on Win machine, it is only a Mac issue :-(

Steps:
1. Insert page break before Heading 1
2. Clear formatting on the new page.
On Mac crash, on WIN does not.
Comment 4 QA Administrators 2024-05-10 03:17:20 UTC Comment hidden (obsolete)
Comment 5 Stéphane Guillou (stragu) 2024-05-22 04:30:32 UTC
(In reply to vika from comment #3)
> Steps:
> 1. Insert page break before Heading 1
> 2. Clear formatting on the new page.
> On Mac crash, on WIN does not.
Can you please clarify the steps? What exactly do you use for "clear formatting"? Is it Format > Clear Direct Formatting?
And what do you mean by "new page"? The blank page before Heading 1?
Comment 6 vika 2024-05-22 05:33:29 UTC
Clear formatting is proceeded from the Formatting toolbar.

Insert page is proceeded from menu Insert | Page break.

Writer crashes only on Mac when "Numeric with sublevels" is used for Heading numbering.
I've recorded a short video: https://filesender.arnes.si/?s=download&token=d79d52b1-aa93-4672-a102-a51a37e55bae
Comment 7 QA Administrators 2024-05-23 03:17:34 UTC Comment hidden (obsolete)
Comment 8 Telesto 2024-05-23 07:49:16 UTC
Created attachment 194289 [details]
Example file

1. Open the attached file
2. Toolbar > Paragraph style drop down box -> clear all formatting -> crash

Confirm with a 8 weeks old build
Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: aef28c23adc87b8e26eacb56c7dbcf652e907fb9
CPU threads: 8; OS: macOS 14.3; UI render: Skia/Raster; VCL: osx
Locale: nl-NL (nl_NL.UTF-8); UI: en-US
Calc: threaded
Comment 9 Patrick (volunteer) 2024-05-30 23:06:14 UTC
Created attachment 194465 [details]
Crash log after performing steps in comment #8 of this bug
Comment 10 Patrick (volunteer) 2024-05-30 23:10:05 UTC
(In reply to Patrick Luby (volunteer) from comment #9)
> Created attachment 194465 [details]
> Crash log after performing steps in comment #8 of this bug

I can reproduce the crash in my local build (see attachment #194465 [details] for crash log) using Tolesto's steps in comment #8.

I will take a look at the code and see if I can fix the crash. I will post again when I have any news.
Comment 11 Patrick (volunteer) 2024-05-31 20:32:28 UTC
I have submitted the following patch that fixes the bug for me:

https://gerrit.libreoffice.org/c/core/+/168304

What I found is that the current object that we are executing code in is deleted out from underneath us so I moved the call after all the calls that still need the current object to be alive.

I'll post again when this change is available in the LibreOffice nightly master builds.
Comment 12 Commit Notification 2024-06-11 21:19:28 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6f4adc1274cfac30b9097411bb193bd4386969f0

tdf#160801 fix crash by delaying resetting of attributes

It will be available in 25.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 13 Patrick (volunteer) 2024-06-11 21:30:12 UTC
I have committed a fix this bug. The fix should be in tomorrow's (12 June 2024) nightly master builds:

https://dev-builds.libreoffice.org/daily/master/current.html

Note for macOS testers: the nightly master builds install in /Applications/LibreOfficeDev.app. These builds are not codesigned like regular LibreOffice releases so you will need to execute the following Terminal command after installation but before you launch /Applications/LibreOfficeDev:

xattr -d com.apple.quarantine /Applications/LibreOfficeDev.app
Comment 14 Commit Notification 2024-06-12 06:50:36 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/48acaca27e84b914d37770a75b37da264e1a96fb

tdf#160801 fix crash by delaying resetting of attributes

It will be available in 24.2.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.
Comment 15 Commit Notification 2024-06-13 04:06:44 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

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

tdf#160801 fix crash by delaying resetting of attributes

It will be available in 24.8.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.