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
dev
Ander Conselvan de Oliveira 11 years ago committed by Kristian Høgsberg
parent 301f06b894
commit 4ade0e4a29
  1. 15
      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);

Loading…
Cancel
Save