gdbus: Fix removal of filter after last filter_data
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Mon, 25 Jun 2012 15:44:40 +0000 (12:44 -0300)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 30 Jun 2012 08:36:14 +0000 (10:36 +0200)
commit15df59f39050e7f94ab5ee97ccd8be31b3c34306
tree6f11f5c791911f81a8de16b37abb4764e510461a
parent8beabba8c702d04e7de5ad04d6ecbcf5b91e24ce
gdbus: Fix removal of filter after last filter_data

If there's a signal watch that's also watching for name
(data->name_watch) currently we are trying to remove the message_filter
twice since we may have the following call chain:

filter_data_remove_callback()
  filter_data_free()
    g_dbus_remove_watch()
      filter_data_remove_callback()
filter_data_free()
        dbus_connection_remove_filter()
  dbus_connection_remove_filter()

Because of this we can't currently watch for signals passing the bus
name. After this patch we don't have this issue anymore.

We fix it by removing the filter before calling filter_data_free() if we
are the last filter_data and thus avoid calling
dbus_connection_remove_filter() twice.
gdbus/watch.c