gdbusproxy stops tracking if dbus service restarts
Submitted by and..@..gmx.de
Assigned to David Zeuthen
I created a DBus service and a client with glib (GDBUS).
To create an adaptor for the client I used the method:
mProxy = myService_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, SERVICE_NAME, SERVICE_PATH, NULL, &mError);
As long as I understand this, basically a struct gets filled with the data I pass to the method (service-name, path, etc.). After that this creates a GDBusConnection which has the socket of the system bus as a property.
To call methods I use:
myService_call_myMethod_sync(mProxy, &res, NULL, &mError);
This works fine for my until my DBus service gets shut down during the client lifetime.
After that, the client requests are going into nowhere and the client isnt able to communicate with my dbus-service anymore. I get errors like: GLib-GIO-CRITICAL **: g_dbus_proxy_call_sync_internal: as sertion `error == NULL || *error == NULL' failed. I think this is a bug, because normally the service should get started by the client if the name doesnt exist on the system bus. To fix this I started to call the myService_dbus_adaptor_proxy_new_for_bus_sync-method in every client method with the exact same parameters. Now I can restart my dbus-service and the client is still able to communicate with it.
Why is it, that this GDBusProxy stops tracking if my DBus-service restarts? Like described above, my understanding is, that GDBusProxy is just a struct filled with data which remains the same. If no service with the specified name is running, my client should start the service. But that only works if I created a new proxy for that. Is this a bug?