From: Ander Conselvan de Oliveira Date: Thu, 17 Apr 2014 10:08:45 +0000 (+0300) Subject: compositor-drm: Fix crash when setting up seat constrained by an output X-Git-Tag: 1.4.92~57 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ade0e4a29f4d7313bcc24cacd34596c110f7ba2;p=platform%2Fupstream%2Fweston.git compositor-drm: Fix crash when setting up seat constrained by an output Commit 58e15865 changed the parameters for udev_get_seat_by_name() to receive a struct udev_input. However, when this gets called from create_output_from_connector() during initialization, the input struct is not yet initialized, leading to a crash. Previously, that function would take only a pointer to the compositor. This patch fixes the crash by initializing input before creating any outputs. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77503 --- diff --git a/src/compositor-drm.c b/src/compositor-drm.c index 5765b40..9d293bc 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -2783,9 +2783,15 @@ drm_compositor_create(struct wl_display *display, wl_list_init(&ec->sprite_list); create_sprites(ec); + if (udev_input_init(&ec->input, + &ec->base, ec->udev, param->seat_id) < 0) { + weston_log("failed to create input devices\n"); + goto err_sprite; + } + if (create_outputs(ec, param->connector, drm_device) < 0) { weston_log("failed to create output for %s\n", path); - goto err_sprite; + goto err_udev_input; } /* A this point we have some idea of whether or not we have a working @@ -2795,12 +2801,6 @@ drm_compositor_create(struct wl_display *display, path = NULL; - if (udev_input_init(&ec->input, - &ec->base, ec->udev, param->seat_id) < 0) { - weston_log("failed to create input devices\n"); - goto err_sprite; - } - loop = wl_display_get_event_loop(ec->base.wl_display); ec->drm_source = wl_event_loop_add_fd(loop, ec->drm.fd, @@ -2843,6 +2843,7 @@ err_udev_monitor: udev_monitor_unref(ec->udev_monitor); err_drm_source: wl_event_source_remove(ec->drm_source); +err_udev_input: udev_input_destroy(&ec->input); err_sprite: ec->base.renderer->destroy(&ec->base);