gui: recreate QDBusInterface on service restart

QDBusInterface caches introspection data and can become stale after
the backing service restarts. This caused ListSessions calls to
silently fail, leaving the GUI empty after an olliesrv restart.

Recreate m_iface in the serviceRegistered handler to ensure a fresh
connection to the new service instance.
This commit is contained in:
Levi Neely 2026-07-19 14:16:17 +02:00
parent cf637b2674
commit cd612d2812
1 changed files with 5 additions and 0 deletions

View File

@ -25,6 +25,11 @@ OllieDBusClient::OllieDBusClient(QObject *parent)
QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration, QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration,
this); this);
connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, [this]() { connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, [this]() {
// Recreate the interface — QDBusInterface caches introspection and can
// become stale after the service restarts.
delete m_iface;
m_iface = new QDBusInterface(SERVICE, OBJ_PATH, IFACE,
QDBusConnection::sessionBus(), this);
refreshSessions(); refreshSessions();
}); });
connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, [this]() { connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, [this]() {