Fix mutex hang in colord on output removal

Using the x11 output (maybe with others as well), weston would hang
when closing the output if the colord plugin is enabled.

The hang occurs in mutex lock in the output notifier handler because
the given GMutex value is incorrect.

This is because of a cast error, the type of container should be
"cms_output" and not "cms_colord".

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Richard Hughes <richard@hughsie.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
dev
Olivier Fourdan 10 years ago committed by Bryce Harrington
parent b73c58e6d7
commit 2e710e51bb
  1. 12
      src/cms-colord.c

@ -212,10 +212,11 @@ colord_device_changed_cb(CdDevice *device, struct cms_output *ocms)
static void static void
colord_notifier_output_destroy(struct wl_listener *listener, void *data) colord_notifier_output_destroy(struct wl_listener *listener, void *data)
{ {
struct cms_colord *cms = struct cms_output *ocms =
container_of(listener, struct cms_colord, destroy_listener); container_of(listener, struct cms_output, destroy_listener);
struct weston_output *o = (struct weston_output *) data; struct weston_output *o = (struct weston_output *) data;
struct cms_output *ocms; struct cms_colord *cms = ocms->cms;
gboolean ret; gboolean ret;
gchar *device_id; gchar *device_id;
GError *error = NULL; GError *error = NULL;
@ -223,11 +224,6 @@ colord_notifier_output_destroy(struct wl_listener *listener, void *data)
colord_idle_cancel_for_output(cms, o); colord_idle_cancel_for_output(cms, o);
device_id = get_output_id(cms, o); device_id = get_output_id(cms, o);
weston_log("colord: output removed %s\n", device_id); weston_log("colord: output removed %s\n", device_id);
ocms = g_hash_table_lookup(cms->devices, device_id);
if (!ocms) {
weston_log("colord: failed to delete device\n");
goto out;
}
g_signal_handlers_disconnect_by_data(ocms->device, ocms); g_signal_handlers_disconnect_by_data(ocms->device, ocms);
ret = cd_client_delete_device_sync (cms->client, ret = cd_client_delete_device_sync (cms->client,
ocms->device, ocms->device,

Loading…
Cancel
Save