--- hal.c.orig 2009-07-29 15:49:36.000000000 -0700 +++ hal.c 2009-08-02 12:49:58.000000000 -0700 @@ -474,13 +474,13 @@ char **devices; int num_devices, i; - if (info->hal_ctx) - return TRUE; /* already registered, pretend we did something */ - info->system_bus = connection; dbus_error_init(&error); + if (info->hal_ctx) + return TRUE; /* already registered, pretend we did something */ + info->hal_ctx = libhal_ctx_new(); if (!info->hal_ctx) { LogMessage(X_ERROR, "config/hal: couldn't create HAL context\n"); @@ -501,7 +501,7 @@ LogMessage(X_ERROR, "config/hal: couldn't watch all properties: %s (%s)\n", error.name ? error.name : "unknown error", error.message ? error.message : "null"); - goto out_ctx; + goto out_ctx2; } libhal_ctx_set_device_added(info->hal_ctx, device_added); libhal_ctx_set_device_removed(info->hal_ctx, device_removed); @@ -509,12 +509,6 @@ devices = libhal_find_device_by_capability(info->hal_ctx, "input", &num_devices, &error); /* FIXME: Get default devices if error is set. */ - if (dbus_error_is_set(&error)) { - LogMessage(X_ERROR, "config/hal: couldn't find input device: %s (%s)\n", - error.name ? error.name : "unknown error", - error.message ? error.message : "null"); - goto out_ctx; - } for (i = 0; i < num_devices; i++) device_added(info->hal_ctx, devices[i]); libhal_free_string_array(devices); @@ -523,19 +517,13 @@ return TRUE; +out_ctx2: + if (!libhal_ctx_shutdown(info->hal_ctx, &error)) + LogMessage(X_WARNING, "config/hal: couldn't shut down context: %s (%s)\n", + error.name ? error.name : "unknown error", + error.message ? error.message : "null"); out_ctx: - dbus_error_free(&error); - - if (info->hal_ctx) { - if (!libhal_ctx_shutdown(info->hal_ctx, &error)) { - LogMessage(X_WARNING, "config/hal: couldn't shut down context: %s (%s)\n", - error.name ? error.name : "unknown error", - error.message ? error.message : "null"); - dbus_error_free(&error); - } - libhal_ctx_free(info->hal_ctx); - } - + libhal_ctx_free(info->hal_ctx); out_err: dbus_error_free(&error);