Commit bae8204
committed
qtvcp: close dbus bus when sys_notify init fails
If `init()` constructs `dbus.SessionBus(mainloop)` with the
PyQt5/PyQt6 mainloop integration and the subsequent
`bus.get_object(org.freedesktop.Notifications, ...)` call raises
(e.g. `org.freedesktop.DBus.Error.ServiceUnknown` when no
notification daemon owns the name), the Python reference to `bus`
is dropped on the exception, but dbus-python's mainloop layer has
already attached a `QSocketNotifier` to the connection fd. That
notifier keeps the C-level connection alive in a half-initialized
state. On the next Qt event-loop tick, the queued reply is
dispatched via `dbus_connection_dispatch()` and segfaults inside
`_dbus_list_unlink` because the connection's internal queue is no
longer in a consistent state.
Close the bus explicitly on the failure path so the socket
notifier detaches and the connection is released cleanly. The
`Desktop Notify not available` warning continues to be the only
user-visible side effect.
Reproduced on Ubuntu 24.04 CI under xvfb + offscreen Qt where no
session-bus notification daemon is present; gdb -batch captured a
Thread 1 backtrace ending in `dbus_connection_dispatch` ->
`_dbus_list_pop_first_link` -> `_dbus_list_unlink` (segv).1 parent 937ade5 commit bae8204
1 file changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
79 | 97 | | |
80 | 98 | | |
81 | 99 | | |
| |||
0 commit comments