[PATCH v2] config: unregister match rule on disconnect. (#27681)
Peter Hutterer
peter.hutterer at who-t.net
Tue Apr 20 18:52:12 PDT 2010
On disconnect, HAL doesn't unregister the DBus match rule.
After a lot of server generations, we exceed the number of match rules
allowed for a DBus connection:
[config/hal] couldn't add match rule: org.freedesktop.DBus.Error.LimitsExceeded
(Connection ":1.34" is not allowed to add more match rules (increase limits in
configuration file if required))
[config/hal] cannot detect a HAL startup.
We don't care about the error by dbus_bus_remove_match because we won't do
anything about it anyway. It is only provided to force dbus to flush.
X.Org Bug 27681 <http://bugs.freedesktop.org/show_bug.cgi?id=27681>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Acked-by: Daniel Stone <daniel at fooishbar.org>
---
just so the patch is archived on the list.
config/hal.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/config/hal.c b/config/hal.c
index d3daa84..89c5ea4 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -43,6 +43,12 @@
#define LIBHAL_PROP_KEY "input.x11_options."
#define LIBHAL_XKB_PROP_KEY "input.xkb."
+static const char MATCH_RULE[] = "sender='org.freedesktop.DBus',"
+ "interface='org.freedesktop.DBus',"
+ "type='signal',"
+ "path='/org/freedesktop/DBus',"
+ "member='NameOwnerChanged'";
+
struct config_hal_info {
DBusConnection *system_bus;
@@ -426,6 +432,8 @@ disconnect_hook(void *data)
if (info->hal_ctx) {
if (dbus_connection_get_is_connected(info->system_bus)) {
dbus_error_init(&error);
+ dbus_bus_remove_match(info->system_bus, MATCH_RULE, &error);
+ dbus_error_free(&error);
if (!libhal_ctx_shutdown(info->hal_ctx, &error))
LogMessage(X_WARNING, "config/hal: disconnect_hook couldn't shut down context: %s (%s)\n",
error.name, error.message);
@@ -574,11 +582,6 @@ listen_for_startup(DBusConnection *connection, void *data)
{
DBusObjectPathVTable vtable = { .message_function = ownerchanged_handler, };
DBusError error;
- const char MATCH_RULE[] = "sender='org.freedesktop.DBus',"
- "interface='org.freedesktop.DBus',"
- "type='signal',"
- "path='/org/freedesktop/DBus',"
- "member='NameOwnerChanged'";
int rc = FALSE;
dbus_error_init(&error);
@@ -643,5 +646,6 @@ config_hal_init(void)
void
config_hal_fini(void)
{
+ disconnect_hook(&hal_info);
config_dbus_core_remove_hook(&hook);
}
--
1.6.6.1
More information about the xorg-devel
mailing list