https://bugs.documentfoundation.org/show_bug.cgi?id=172678

            Bug ID: 172678
           Summary: Crash on exit (SIGSEGV) with Writer content on the
                    clipboard — SwTransferable destroyed during
                    ~QWaylandClipboard teardown (kf6/qt6 VCL, native
                    Wayland)
           Product: LibreOffice
           Version: 26.2.4.2 release
          Hardware: All
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: graphics stack
          Assignee: [email protected]
          Reporter: [email protected]

Description:
LibreOffice crashes with SIGSEGV **while exiting normally** (closing the
application) when Writer content is still on the clipboard. The crash happens
during `DeInitVCL()`: the Qt Wayland platform integration is being torn down,
and `QtWaylandClient::QWaylandClipboard`'s destructor ends up destroying the
`SwTransferable` that still owns a `SwDoc`. Destroying that document at this
late stage crashes in `SfxItemPool::cleanupItemInfos()` — presumably because
pools/singletons the document depends on have already been destroyed earlier in
shutdown (destruction-order problem).

The user-visible symptom is mild (the app was closing anyway), but it produces
coredumps on every affected exit and likely masks data-loss risk in the
clipboard content ("keep clipboard contents after exit" handoff to the Wayland
clipboard manager presumably never completes).

Steps to Reproduce:
1. Start LibreOffice Writer under KDE Plasma Wayland with the kf6/qt6 VCL
plugin (native Wayland, not XWayland).
2. Type some text, select it, and copy it (Ctrl+C) so a Writer `SwTransferable`
owns the clipboard.
3. Close LibreOffice completely.


Actual Results:
soffice.bin exits with SIGSEGV (exit code 139); a coredump is generated.

Expected Results:
clean exit


Reproducible: Always


User Profile Reset: No

Additional Info:
Reproduced twice on consecutive days with **identical stack traces**
(2026-07-02 21:55 and 2026-07-03 17:14, same machine). Not reproducible so far
with `QT_QPA_PLATFORM=xcb` (XWayland) — the teardown path through
`QWaylandIntegration` is Wayland-specific.

Stack trace (thread 1, from coredumpctl)

```
Signal: 11 (SEGV) si_code: SI_KERNEL
#0  SfxItemPool::cleanupItemInfos()            (libsvllo.so)
#1  SfxItemPool::~SfxItemPool()                (libsvllo.so)
#2  SwAttrPool::~SwAttrPool()                  (libswlo.so)
#3  SwDoc::~SwDoc()                            (libswlo.so)
#4  SwDoc::release()                           (libswlo.so)
#5  SwTransferable::~SwTransferable()          (libswlo.so)
#6  SwTransferable::~SwTransferable() [D0]     (libswlo.so)
#7  ?? (libvclplug_qt6lo.so + 0xa25da)
#8  QtWaylandClient::QWaylandClipboard::~QWaylandClipboard()  
(libQt6WaylandClient.so.6)
#9  QtWaylandClient::QWaylandIntegration::~QWaylandIntegration()
#10 QtWaylandClient::QWaylandIntegration::~QWaylandIntegration() [D0]
#11 QGuiApplicationPrivate::~QGuiApplicationPrivate()  (libQt6Gui.so.6)
#12 QApplicationPrivate::~QApplicationPrivate() [D0]   (libQt6Widgets.so.6)
#13 QApplication::~QApplication() [D0]                 (libQt6Widgets.so.6)
#14 QtInstance::~QtInstance()                  (libvclplug_qt6lo.so)
#15 ?? (libvclplug_kf6lo.so + 0xa2f8)
#16 DeInitVCL()                                (libvcllo.so)
#17 ImplSVMain()                               (libvcllo.so)
#18 soffice_main                               (libsofficeapp.so)
```

(Full trace with addresses and all threads attached.)

## Analysis

Frame #7 (`libvclplug_qt6lo.so`) is presumably `QtClipboardTransferable`/the Qt
VCL clipboard bridge releasing its `css::datatransfer::XTransferable`
reference. The reference to the Writer transferable should be dropped (and the
document destroyed) **before** `QApplication`/platform-integration teardown,
e.g. in `QtInstance`'s shutdown before `~QApplication`, or the flush/handoff of
clipboard contents should happen earlier in exit. By the time
`~QWaylandClipboard` runs, VCL/sw shutdown has progressed too far for a `SwDoc`
destruction to be safe.

## Notes

- No relation to compositor blur effects: reproduced with a plain protocol log
(WAYLAND_DEBUG) showing a normal surface-destroy sequence and no protocol
error.
- Both coredumps available on request (`coredumpctl`, PIDs 489835 and 25125).
- Searched for duplicates: tdf#159683 is Windows-specific (SwHTMLWriter),
tdf#160729 is suspend/resume — neither matches this teardown stack.

**Version:** 26.2.4.2 (Build 2) — Arch Linux (libreoffice-fresh 26.2.4-3)
**OS:** Linux (Arch/CachyOS, kernel 7.1.2), KDE Plasma 6.7.2, Qt 6.11.1
(qt6-wayland 6.11.1)
**VCL plugin:** kf6 (Qt6), running natively on Wayland
(`QT_QPA_PLATFORM=wayland`)

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to