CachyOS / CachyOS/packageinstaller

[Bug]: cachyos-pi crashes with SIGSEGV on QMessageBox close

Open
#59 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
23
Forks
30
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug
cachyos-pi (CachyOS Package Installer, launched directly or via cachyos-hello's "Install Apps" button) reliably crashes with a segmentation fault when a QMessageBox is shown and then closed — for example the package info dialog opened via the "i" (info) button in the package list.

The crash happens inside Qt6 itself, in `QDialogPrivate::setNativeDialogVisible()`, not in application code. It matches a known upstream Qt6 bug (see "Additional context" below): Qt fails to reset an internal "native dialog in use" flag when a QMessageBox is hidden, so the next call into the platform dialog helper dereferences a dangling/invalid pointer.

### To Reproduce
1. Launch cachyos-pi (directly, or via "Install Apps" in cachyos-hello)
2. Click the "i" (info) button on a package in the list — this opens an info
dialog (QMessageBox)
3. Close that dialog by clicking the "x" in the top-right corner
4. Application crashes with SIGSEGV

Also reproducible via any other QMessageBox triggered in the app (e.g. clicking an item in the package list), not just the info dialog.

### Expected behavior
The dialog closes normally without crashing the application.

### Environment
- OS: CachyOS (rolling)
- Kernel: 7.1.3-2-cachyos
- Desktop: KDE Plasma, Wayland
- Qt version: qt6-base 6.11.1-1.1
- cachyos-pi provided by: cachyos-packageinstaller 1.6.2-1
- Full bug report: https://paste.cachyos.org/p/459a17d.log

### Logs / stack trace

```
$ journalctl -f (excerpt)
kernel: cachyos-pi[8185]: segfault at 0 ip 0000000000000000 sp 00007ffde2f4e228 error 14 likely on CPU 9 (core 4, socket 0)
kernel: Code: Unable to access opcode bytes at 0xffffffffffffffd6.
systemd-coredump[8278]: Process 8185 (cachyos-pi) of user 1000 terminated abnormally with signal 11/SEGV, processing...

$ gdb -q --args /usr/bin/cachyos-pi
(gdb) run
(gdb) bt full
Thread 1 "cachyos-pi" received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
#0 0x0000000000000000 in ?? ()
#1 0x00007ffff79ea76d in QDialogPrivate::setNativeDialogVisible(bool) () from /usr/lib/libQt6Widgets.so.6
#2 0x00007ffff7a2c93c in ?? () from /usr/lib/libQt6Widgets.so.6
#3 0x00007ffff7a275c8 in QMessageBox::~QMessageBox() () from /usr/lib/libQt6Widgets.so.6
#4 0x00005555555f6afb in ?? ()
#5 0x00007ffff660fffb in ?? () from /usr/lib/libQt6Core.so.6
#6 0x00007ffff7b2a026 in ?? () from /usr/lib/libQt6Widgets.so.6
#7 0x00007ffff660fffb in ?? () from /usr/lib/libQt6Core.so.6
#8 0x00007ffff7a7bac6 in QAbstractItemView::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQt6Widgets.so.6
#9 0x00007ffff77659d5 in QWidget::event(QEvent*) () from /usr/lib/libQt6Widgets.so.6
#10 0x00007ffff77d7e98 in QFrame::event(QEvent*) () from /usr/lib/libQt6Widgets.so.6
#11 0x00007ffff6597ef8 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/libQt6Core.so.6
#12 0x00007ffff7704c0b in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt6Widgets.so.6
#13 0x00007ffff77066fe in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt6Widgets.so.6
#14 0x00007ffff6598a48 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt6Core.so.6
#15 0x00007ffff76fbd9e in QApplicationPrivate::sendMouseEvent(...) () from /usr/lib/libQt6Widgets.so.6
```

### Additional context
The crash matches a known Qt6 bug reported upstream on the Qt Forum: https://forum.qt.io/topic/164868/qmessagebox-crash-on-close

In `qdialog.cpp`, `QDialogPrivate::setNativeDialogVisible()` sets `nativeDialogInUse = helper->show(...)` when showing a dialog, but never resets `nativeDialogInUse` to `false` when hiding it via `helper->hide()`. On the next call (typically during `QMessageBox` destruction), Qt believes a native dialog helper is still active and calls into it, but the underlying helper has already been released — resulting in a call through a dangling/null pointer. This looks like an upstream Qt6 regression rather than a packaging issue, but cachyos-pi triggers it very reliably (every info dialog / message box), which makes it a good reference case.

Ruled out during debugging:
- Not an a11y/AT-SPI bus issue (`QT_ACCESSIBILITY=0`, `NO_AT_BRIDGE=1` — no effect, bus healthy: `org.a11y.Bus` owned by `at-spi-bus-launcher`, `kwin_wayland` as manager)
- Not an xdg-desktop-portal misconfiguration (both `xdg-desktop-portal-kde` and `xdg-desktop-portal-gtk` active, `QT_QPA_PLATFORMTHEME=` empty — no effect)
- Not a native-dialog-type override issue (`QT_DIALOG_TYPE=widget` : no effect)
- Reproducible from a clean terminal launch of cachyos-pi, not tied to cachyos-hello's "Install Apps" button specifically
- System runs a multi-desktop-session setup (KDE, Hyprland, niri, i3 coexisting via SDDM session selector), but the crash reproduces in a clean KDE/Wayland session with all portals healthy — likely not session-related

Possible workaround for maintainers: avoid triggering native platformdialog helpers for simple in-app QMessageBox usage (e.g. set `Qt::AA_DontUseNativeDialogs` at application startup) until the upstream Qt6 bug is fixed.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating cachyos-pi's application startup and the QMessageBox call sites used by the package list and info dialog. Reproduce the close action on Qt 6.11.1, then evaluate the suggested Qt::AA_DontUseNativeDialogs workaround; done means all described QMessageBox dialogs close without a SIGSEGV.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.