Bug 161729 - Libreoffice crashes on close (macOS)
Summary: Libreoffice crashes on close (macOS)
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.4.2 release
Hardware: ARM macOS (All)
: medium critical
Assignee: Patrick (volunteer)
URL:
Whiteboard: target:25.2.0 target:24.8.0.2 target:...
Keywords:
Depends on:
Blocks: Crash
  Show dependency treegraph
 
Reported: 2024-06-21 11:29 UTC by Daniele
Modified: 2024-07-25 05:40 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
small file (15.70 KB, application/vnd.oasis.opendocument.text)
2024-07-14 17:32 UTC, Daniele
Details
big file (984.44 KB, application/vnd.oasis.opendocument.text)
2024-07-14 17:33 UTC, Daniele
Details
video showing the bug (1.50 MB, video/mp4)
2024-07-14 17:33 UTC, Daniele
Details
macOS crash log (131.86 KB, text/plain)
2024-07-14 21:36 UTC, Patrick (volunteer)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniele 2024-06-21 11:29:48 UTC
Description:
Almost every time I close Libreoffice it crashes (since I reverted back to 7.6.7.2.) Sorry I cannot reproduce. It happened both with large files and small files. I work a lot with texts divided in tables.

Steps to Reproduce:
1.Open a few large files
2.Close them
3.LO crashes and asks to save the opened files.

Actual Results:
LO crashes 

Expected Results:
LO should not crash 


Reproducible: Always


User Profile Reset: No

Additional Info:
Below is my present version, but it happened with 24.2.4.2.

Version: 7.6.7.2 (X86_64) / LibreOffice Community
Build ID: dd47e4b30cb7dab30588d6c79c651f218165e3c5
CPU threads: 8; OS: Mac OS X 14.5; UI render: Skia/Metal; VCL: osx
Locale: en-US (en.UTF-8); UI: en-US
Calc: threaded
Comment 1 Daniele 2024-06-21 11:49:17 UTC
On second thought, I think that it crashed most times not all the time.
Comment 2 Dieter 2024-07-07 13:12:11 UTC
Daniele, thank you for reporting the bug. I remember that a bug, that crashed macOS has been fixed recently. So please retest LO 24.2.5.2 (will be relased in one week). And of course you can install master in parallel and retest. Please provide feedback after testing wih 24.2.5.2
=> NEEDINFO
Comment 3 Daniele 2024-07-07 17:37:15 UTC
Thank you Dieter,
meanwhile, I discovered that it crashed so often due to Languagetool proofing tool (filed a separate bug 161858). Now it crashes very seldom (I switched back to 24.2.4.2). What happens, is that upon closing a document it often shows the empty recovery window.
I will try to download 24.2.5.2. What I am not familiar with is what you say here "you can install master in parallel and retest". What is master? Is it 24.2.4.2?
Thanks.
Comment 4 QA Administrators 2024-07-08 03:16:43 UTC Comment hidden (obsolete)
Comment 5 Daniele 2024-07-08 13:09:59 UTC
Update, it still crashes from time to time. Today when I had two documents open and I closed one, it crashed and the recovery window opened with the other one in it. But I am unable to reproduce with other documents.
Comment 6 Stéphane Guillou (stragu) 2024-07-08 14:59:56 UTC
I could not reproduce with two Writer documents opened at the same time and closing one of them.

Version: 24.2.4.2 (X86_64) / LibreOffice Community
Build ID: 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2
CPU threads: 4; OS: macOS 14.5; UI render: Skia/Raster; VCL: osx
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

(In reply to Daniele from comment #3)
> I will try to download 24.2.5.2. What I am not familiar with is what you say
> here "you can install master in parallel and retest". What is master? Is it
> 24.2.4.2?
Dieter means an alternative is testing the latest daily build, available here: https://dev-builds.libreoffice.org/daily/master/current.html
It will not replace your current installation, it will be called "LibreOfficeDev". Note that it might not be allowed to run because it is not signed, in which case you would have to run the following in the Terminal:

xattr -d com.apple.quarantine /Applications/LibreOfficeDev.app

If you can consistently reproduce a crash, it would be very helpful if you could collect some more information about it, please see: https://wiki.documentfoundation.org/QA/BugReport/Debug_Information#macOS:_How_to_get_debug_information
Comment 7 Daniele 2024-07-14 17:32:27 UTC
Hi Stéphane, thanks.
I just went ahead and downloaded the last official version (see below) because I could already reproduce with 2.4.2.4.

To reproduce: open the big and the small attached documents below. Make a modification in the big one, save, close it. LO crashes and proposes to recover the small one. Also video of what happens attached.







Version: 24.2.5.2 (X86_64) / LibreOffice Community
Build ID: bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59
CPU threads: 8; OS: macOS 14.5; UI render: Skia/Metal; VCL: osx
Locale: en-US (en.UTF-8); UI: en-US
Calc: threaded
Comment 8 Daniele 2024-07-14 17:32:50 UTC
Created attachment 195293 [details]
small file
Comment 9 Daniele 2024-07-14 17:33:14 UTC
Created attachment 195294 [details]
big file
Comment 10 Daniele 2024-07-14 17:33:37 UTC
Created attachment 195295 [details]
video showing the bug
Comment 11 Daniele 2024-07-14 17:50:04 UTC
Just a note, I have languagetool grammar checker on (I am filing an update on a bug for LO crash without doing anything with both attached documents open after a few minutes). Letting you know just in case there was a connection with this bug too.
Comment 12 Daniele 2024-07-14 20:34:42 UTC
Deactivated LT on the same LO version, opened the same files and it did not crash for two hours (and has not crashed yet).
When I had LT open, it crashed after 15minutes.
Comment 13 Patrick (volunteer) 2024-07-14 21:36:24 UTC
Created attachment 195301 [details]
macOS crash log
Comment 14 Patrick (volunteer) 2024-07-14 21:38:52 UTC
(In reply to Patrick Luby (volunteer) from comment #13)
> Created attachment 195301 [details]
> macOS crash log

I can reproduce this bug in my local master build on my M1 MacBook Pro.

I will look at the source code files listed in my attached crash log and see if there is anything I can change to prevent this bug. AFAICT, the crash looks like it is due to a null pointer.
Comment 15 Patrick (volunteer) 2024-07-15 12:42:22 UTC
(In reply to Patrick Luby (volunteer) from comment #14)
> I will look at the source code files listed in my attached crash log and see
> if there is anything I can change to prevent this bug. AFAICT, the crash
> looks like it is due to a null pointer.

Correction: the crash is due to a "use pointer after has been freed" error. I will need to dig deeper into the code to try and figure out which code is deleting the SfxItemPool where the crash occurs in.
Comment 16 Patrick (volunteer) 2024-07-19 01:46:14 UTC
I think I have found a fix for this crashing bug and I have submitted the following patch for review:

https://gerrit.libreoffice.org/c/core/+/170707
Comment 17 Daniele 2024-07-19 13:52:26 UTC
Hi Patrick,
I had begun this bug with the title LO crashes on close, but reading the thread I realize that I have also included some cases in which it crashes without the user closing the document.
Now I have updated to 24.2.5.2 and deactivated LanguageTool.
It still crashes on close, not all the time I believe, sometimes corrupting one of the files (usually the biggest).

I am writing this just in case for your patch you assumed I still had LanguageTool activated.

Version: 24.2.5.2 (X86_64) / LibreOffice Community
Build ID: bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59
CPU threads: 8; OS: macOS 14.5; UI render: Skia/Metal; VCL: osx
Locale: en-US (en.UTF-8); UI: en-US
Calc: threaded
Comment 18 Commit Notification 2024-07-20 11:01:49 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/926ed71244c20d5a96d0f20b7c4edfb9e645a667

tdf#161729 clear style sheets in same order as they were added

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 19 Patrick (volunteer) 2024-07-20 12:06:25 UTC
(In reply to Daniele from comment #17)
> Hi Patrick,
> I had begun this bug with the title LO crashes on close, but reading the
> thread I realize that I have also included some cases in which it crashes
> without the user closing the document.
> Now I have updated to 24.2.5.2 and deactivated LanguageTool.
> It still crashes on close, not all the time I believe, sometimes corrupting
> one of the files (usually the biggest).
> 
> I am writing this just in case for your patch you assumed I still had
> LanguageTool activated.

Thank you for the update. I can confirm that LibreOffice crashes when LanguageTool is disabled. For me, LibreOffice crashes every time if I do the following steps:

1. Open both the "big file" and "small file" in LibreOffice
2. In the "big file", replace a character "El ingenioso hidalgo don Quijote de la Mancha" text in the top-right table cell
3. Save the "big file"
4. Close the "big file" and LibreOffice crashes

My first attempt to fix this (see comment #16) fixed this bug but caused other test documents to crash.

Fortunately, I found another way to fix this bug that I committed this morning (see comment #18).

I will post another comment with instructions for downloading a "test version" (also known as a "nightly master build") so that you can test my fix.
Comment 20 Patrick (volunteer) 2024-07-20 12:14:02 UTC
I have committed a fix this bug. The fix should be in tomorrow's (21 July 2024) nightly master builds:

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

Note for macOS testers: the nightly master builds do not overwrite any LibreOffice official versions. Instead, it will be installed as a separate application called "LibreOfficeDev" in the /Applications folder.

Because this is a "test" build, you will need to do the following steps before you launch the LibreOfficeDev application:

1. Go to the Finder and navigate to the /Applications/Utilities folder
2. Launch the "Terminal" application
3. Paste the following command in the Terminal application window and press the Return key to execute the command:

   xattr -d com.apple.quarantine /Applications/LibreOfficeDev.app
Comment 21 Daniele 2024-07-23 17:08:25 UTC
Hi Patrick,
thank you fo the fix and instructions. Is it MacOSX-aarch64@tb94-TDF or MacOSX-aarch64@tb92-TDF I need to install?
Comment 22 Patrick (volunteer) 2024-07-23 17:25:59 UTC
(In reply to Daniele from comment #21)
> Hi Patrick,
> thank you fo the fix and instructions. Is it MacOSX-aarch64@tb94-TDF or
> MacOSX-aarch64@tb92-TDF I need to install?

Just download the one with the newest date. I am not sure why only server has a newer build than the other, but is you download the one with the newest date, it should include the fix to this bug and the fix for tdf#161858.

Also, for anyone else who wants to download the latest nightly build, use the following to determine which build will work on your Mac:

- MacOSX-aarch64 files are for Silicon Macs (generally newer Macs)
- MacOSX-x86_64 files are for Intel Macs (generally older Macs)
Comment 23 Commit Notification 2024-07-25 05:40: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/0e0cf37dde9112b8ccf1cf0e759bf3aadf78dd66

tdf#161729 clear style sheets in same order as they were added

It will be available in 24.8.0.2.

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 24 Commit Notification 2024-07-25 05:40:47 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

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

tdf#161729 clear style sheets in same order as they were added

It will be available in 24.2.6.

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.