I have an application written in vala which communicates to another process (written in vala) using dbus-daemon. It works fine. But it fails to communicate after dbus-daemon is restarted.
My application ( which is not restarted) tries to re connect to the dbus daemon after dbus daemon is restarted. I have cleanup code for the dbus connection references within my application area. But the GTK.Application initiates dbus connection for its use. This is not cleaned up after dbus daemon is terminated.
Since the references of dbus-connection is not cleaned in the GTK.Application, the dbus-connection returned after failover remains the same and it returns “connection is closed” error for dbus operations.
Is there a way to do a cleanup ( basically remove the references of dbus-connection) in the GTK.Application code? Or anybody has tried to exclude the dbus-connection initiation in the GTK.Application code during startup?
During my debugging, I tried the following.
I tried to unref the dbus-connection 4-5 times ( within my dbus cleanup code), and then the reconnection to the dbus-daemon would work. This means the dbus-connection is in use in some other area (I assume, GTK.Application code) and it is not properly cleaned up after the dbus-daemon is terminated. When I do unref ( for debugging purpose) 4-5 times in the cleanup code, and then if I stop my application, it results in segmentation fault in the GTK.Application code area ( which is explainable as the stale memory pointers of dbus-connection is still in use in GTK.Application code.