Issues when using multiple instances of a GDBusObjectManagerClient
Submitted by Patrick Ohly
Assigned to David Zeuthen
Link to original bug (#684380)
Description
Created attachment 224757 test program
Consider the situation that two independent modules in a process need an ESourceRegistry. They both create their own instance. Now one module gets destructed and frees its instance.
The other instance should continue to work.
In reality, destroying the second instance unsubscribes the process from /org/gnome/evolution/dataserver/SourceManager signals and thus prevents receiving further updates for config changes via the first instance.
The root problem is that org.freedesktop.DBus.Add/RemoveMatch are not recursive. They use the message filter as key, therefore a process can only subscribe/unsubscribe globally per connection.
Attached a test program. Compile with
g++ -g pkg-config --cflags --libs libedataserver-1.2
registry.cpp -o /tmp/registry
Then run it with G_DBUS_DEBUG=message /tmp/registry.
After the second registry got destroyed, add or remove files in ~/.config/evolution/sources. The process no longer receives signals for those changes, which it would have received earlier.
Attached also an example log file.
Attachment 224757, "test program":
registry.cpp