Fixes #2 (closed)
There is currently a bug in how subscriptions are handled which causes clients to sometimes not be notified about changes to the database that they have subscribed to: #2 (closed)
It is possible for clients to have many subscriptions to the same key path. Before !1 (merged), this was handled simply by adding/removing the corresponding D-Bus match rule every time a client unsubscribed. !1 (merged) however incorrectly assumes that there is only one subscription to each path, and that the client library handled deduplicating subscriptions, when it fact is was D-Bus that handled this.
- Instead of storing a set of paths in the pending/establishing and active/watched states like !1 (merged), store the number of subscriptions for each path in a hash table. This generalises to multiple simultaneous subscriptions, since the count can be increased when subscribing and decreased when unsubscribing to ensure that the D-Bus match rule (only one) is removed when the number of client subscriptions falls to zero.
- Add a lock
subscription_count_lockaround access to these hash tables, to ensure that the process of changing a subscription's state is atomic and thread safe.
- Add items to
dconf_engine_unrefwhich were previously missing
- Add debug logging statements
Add/extend unit tests to more thoroughly test this new behaviour
Add spaces before function parentheses and fix other syntax related style issues