summaryrefslogtreecommitdiffstats
path: root/unit/test-util.c
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2012-10-03 14:57:22 +0300
committerDenis Kenzior <denkenz@gmail.com>2012-10-31 16:18:45 -0500
commit5236c01a3139f6bac4c6cc1b90e3df0547f022ed (patch)
tree0561aa50d24e3c2366e25dd43edab881bfbc6df7 /unit/test-util.c
parent5033e06844b43ddbd754197469d1fc1db0be28d0 (diff)
downloadofono-5236c01a3139f6bac4c6cc1b90e3df0547f022ed.tar.bz2
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 (limited to 'unit/test-util.c')
0 files changed, 0 insertions, 0 deletions