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:
parent
cf637b2674
commit
cd612d2812
|
|
@ -25,6 +25,11 @@ OllieDBusClient::OllieDBusClient(QObject *parent)
|
|||
QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration,
|
||||
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();
|
||||
});
|
||||
connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, [this]() {
|
||||
|
|
|
|||
Reference in New Issue