Bug 161073 - libreoffice 24.2.2.2 doesn't work with glib 2.80
Summary: libreoffice 24.2.2.2 doesn't work with glib 2.80
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
24.2.2.2 release
Hardware: All NetBSD
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:24.8.0 target:24.2.4
Keywords:
: 161163 161275 161425 161486 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-05-14 14:31 UTC by Thomas Klausner
Modified: 2024-06-10 07:14 UTC (History)
5 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 Thomas Klausner 2024-05-14 14:31:01 UTC
Description:
In pkgsrc, we had updated to 2.80.2. Then libreoffice 24.2.2.2 did not start up any longer, it just reports "Unspecified Application Error" and quits.
ryoon@NetBSD.org found one commit in glib2 that, if backed out, fixes this problem (this commit has now been backed out in pkgsrc locally): https://gitlab.gnome.org/GNOME/glib/-/commit/747e3af9987b37847d7d5acbf882d1ee4a6bd91b "gdbusconnection: Fix user_data leaks on error"

I've reported this to glib upstream first:
https://gitlab.gnome.org/GNOME/glib/-/issues/3365

But they say that this is a bug in libreoffice:
"LibreOffice should not manually free the user data if it passes a GDestroyNotify, regardless of the function return value."


Actual Results:
see above

Expected Results:
see above


Reproducible: Always


User Profile Reset: Yes

Additional Info:
see above
Comment 1 Eike Rathke 2024-05-14 15:35:59 UTC
@Caolan: likely from vcl/unx/gtk3.
Comment 2 Caolán McNamara 2024-05-15 07:57:13 UTC
The function patched in the upstream commit appears to be g_dbus_connection_register_object where it now calls user_data_free_func on user_data on failure

We only call g_dbus_connection_register_object in two places, and one of them doesn't pass a user_data_free_func, so I presume it has to be the one in vcl/unx/gtk3/hudawareness.cxx in which case

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

would solve it
Comment 3 Thomas Klausner 2024-05-15 09:10:45 UTC
Thanks for the patch.
I sadly have to report that this is not enough.

I tried applying it to 24.2.2.2 and switching back to the unpatched glib 2.80.2 and I get the "Unspecified Application Error" again.

I tried starting libreoffice with `--backtrace` but it's been 20 minutes and I don't even have the splash screen filled in yet.
Comment 4 Commit Notification 2024-05-15 10:23:34 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/436f823c7c5497f2b22762cec5849a0ff84c220b

tdf#161073 handle is supposed to be freed automatically on failure

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 5 Caolán McNamara 2024-05-15 10:41:23 UTC
run

gdb soffice.bin 

and break on g_dbus_connection_register_object and see which one is before the crash?

I only see the patched case above and one or two other ones hidden behind g_dbus_connection_export_menu_model and g_dbus_connection_export_action_group
Comment 6 Philip Withnall 2024-05-15 12:45:43 UTC
> I only see the patched case above and one or two other ones hidden behind g_dbus_connection_export_menu_model and g_dbus_connection_export_action_group

(GLib maintainer here)

Depending on what the backtrace turns out to reveal, it’s possible that the crash is actually a similar latent bug in g_dbus_connection_export_menu_model(), which we’ve just fixed in GLib upstream, see https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4073.

Thanks for the fast fix for the g_dbus_connection_register_object() case in LibreOffice.
Comment 7 Thomas Klausner 2024-05-15 13:42:11 UTC
I've tested glib2 2.80.2 plus the patch from https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4073 and for my startup-screen problem, I then don't even need the patch by Caolán. It's probably correct and should stay anyway, but seems to be in a different code path.

Please close this when you have decided what to do with that patch. Thank you!
Comment 8 Philip Withnall 2024-05-15 13:56:32 UTC
The patch by Caolán is definitely correct, and was a bug in LibreOffice.
Comment 9 Commit Notification 2024-05-15 22:00:19 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

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

tdf#161073 handle is supposed to be freed automatically on failure

It will be available in 24.2.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.
Comment 10 Caolán McNamara 2024-05-15 22:11:40 UTC
Well, merged to trunk and 24.2. 7.6.7 was the last 7.6 and is already released.

Its a pretty high hit rate on uses -> bugs though.
Comment 11 Caolán McNamara 2024-05-20 15:15:54 UTC
*** Bug 161163 has been marked as a duplicate of this bug. ***
Comment 12 Julien Nabet 2024-05-26 19:22:54 UTC
*** Bug 161275 has been marked as a duplicate of this bug. ***
Comment 13 Stéphane Guillou (stragu) 2024-06-06 06:04:17 UTC
*** Bug 161425 has been marked as a duplicate of this bug. ***
Comment 14 Julien Nabet 2024-06-10 07:14:46 UTC
*** Bug 161486 has been marked as a duplicate of this bug. ***