Parent: abfc2b0dd5c3e33abfdf1a815b16d492c1751c06
Author: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Committer: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: 2012-09-27 10:53:44
Tree: 0e7659d6c7ac67969e0041fe9a304145c85b5d05
gdbus: Fix wrong signal handler match When we add a signal handler with g_dbus_add_signal_watch(), this function tries to multiplex the matches added in libdbus by checking if there's a previous filter_data with the same fields. However, if the field is NULL it accepts as being the same. The result is that the following watches will use the same filter data: watch1 = g_dbus_add_signal_watch(conn, BUS_NAME, NULL, iface, member, cb1, data1, NULL); watch2 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path2", iface, member, cb2, data2, NULL); watch3 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path3", iface, member, cb3, data3, NULL); The result is that when a signal arrives with path == "/path2", all 3 callbacks above will be called, with the same signal delivered to all of them. Another problem is that, if we invert the calls like below, only signals to cb1 will never be trigerred, nonetheless it used path == NULL. watch2 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path2", iface, member, cb2, data2, NULL); watch1 = g_dbus_add_signal_watch(conn, BUS_NAME, NULL, iface, member, cb1, data1, NULL); watch3 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path3", iface, member, cb3, data3, NULL); This is fixed by not multiplexing the matchs with filter data if any of the fields are different, including being NULL. When a signal arrives, if a field is NULL we accept it as a match, but not when adding the signal handler.
Diffstat
| M | gdbus/watch.c | | | 115 | ++++++++++++++++++++++++++++++++++++++++- - - - - - - - - - - - - - - - - - - - - |
1 files changed, 94 insertions(+), 21 deletions(-)