Bug 167572 - gtk4 VCL crashes immediately with free(): invalid pointer
Summary: gtk4 VCL crashes immediately with free(): invalid pointer
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
25.2.5.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Gtk4
  Show dependency treegraph
 
Reported: 2025-07-18 11:16 UTC by Tekstryder
Modified: 2025-07-21 11:41 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
gdb-bt-full (26.56 KB, text/plain)
2025-07-18 11:18 UTC, Tekstryder
Details
gdb-t-a-a-bt-full (97.62 KB, text/plain)
2025-07-18 11:18 UTC, Tekstryder
Details
strace-crash (6.56 MB, text/plain)
2025-07-18 15:51 UTC, Tekstryder
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tekstryder 2025-07-18 11:16:56 UTC
Description:
When launching LO using the GTK4 renderer it errors and crashes immediately.

This has been occurring for many releases. Not sure I've ever seen it functional.

Same crashing behavior under Gnome, Sway, and Hyprland.

I always delete ~/.config/libreoffice prior to reproducing any issue.

NOTE: This is a pure native Wayland environment without Xwayland.

Attaching GDB backtraces.

```
$ SAL_USE_VCLPLUGIN=gtk4 libreoffice --calc
Failed to open display
free(): invalid pointer
Gtk-Message: 07:01:06.696: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: 07:01:14.509: GtkDialog mapped without a transient parent. This is discouraged.
```

```
Jul 17 12:03:05 systemd-coredump[102259]: Process 102198 (soffice.bin) of user 1000 terminated abnormally with signal 11/SEGV, processing...
Jul 17 12:03:05 systemd[1]: Started Process Core Dump (PID 102259/UID 0).
Jul 17 12:03:06 systemd-coredump[102260]: [🡕] Process 102198 (soffice.bin) of user 1000 dumped core.
```

- kernel 6.15.7
- gtk3 3.24.49
- gtk4 4.18.6
- sway 1.11 (*Native Wayland*)
- wlroots 0.19 (*Vulkan Backend*) (*-Dxwayland=disabled*)
- hyprland 0.50 (*-DNO_XWAYLAND:STRING=true*)
- mutter 48.4 (*-Dxwayland=false -Dx11=false*)

Version: 25.2.5.2 (X86_64) / LibreOffice Community
Build ID: 520(Build:2)
CPU threads: 24; OS: Linux 6.15; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
25.2.5-1
Calc: threaded

Steps to Reproduce:
1. Launch LibreOffice with SAL_USE_VCLPLUGIN=gtk4
2. Observe errors and crash

Actual Results:
Errors and crash

Expected Results:
Functional LO using GTK4


Reproducible: Always


User Profile Reset: Yes

Additional Info:
See attached GDB Backtraces
Comment 1 Tekstryder 2025-07-18 11:18:24 UTC
Created attachment 201872 [details]
gdb-bt-full
Comment 2 Tekstryder 2025-07-18 11:18:58 UTC
Created attachment 201873 [details]
gdb-t-a-a-bt-full
Comment 3 Tekstryder 2025-07-18 15:50:52 UTC
Also attaching an strace of the launch/crash.
Comment 4 Tekstryder 2025-07-18 15:51:29 UTC
Created attachment 201875 [details]
strace-crash
Comment 5 Michael Weghorn 2025-07-21 06:42:29 UTC
(In reply to Tekstryder from comment #1)
> Created attachment 201872 [details]
> gdb-bt-full

I can't reproduce with current master.

The backtrace looks very similar to the one mentioned in
https://git.libreoffice.org/core/commit/38024bc9559d75696eb8c91ac5b0b41be0baa55f
(see the full commit message for more details)

    commit 38024bc9559d75696eb8c91ac5b0b41be0baa55f
    Author: Michael Weghorn
    Date:   Fri Feb 14 13:37:23 2025 +0100

        gtk4: Own the string when freeing it


That's contained in LibreOffice 25.8 only, backport for 25.2 now pending in Gerrit:
https://gerrit.libreoffice.org/c/core/+/188096

-> closing as fixed, please retest with LibreOffice 25.8 (release candidate or once it has been released and included in your distro) or a 25.2 version containing the fix (once there is one) and report back here (and reopen if you still see this).

Please also note that the gtk4 VCL plugin is still considered experimental which is why it's not enabled by default.

Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 0cada4591d1f7dedbc158ad514adfa2ebaf9ec02
CPU threads: 32; OS: Linux 6.12; UI render: default; VCL: gtk4
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: threaded
Comment 6 Tekstryder 2025-07-21 11:41:34 UTC
Awesome. Thanks so much for your prompt attention.

I built LO 25.2.5.2 with the patch and can confirm the GTK4 backend is now functional.

Marking as VERIFIED.