mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-08 11:18:43 +02:00
libweston: fix animation crash when a view has no output assigned
This fixes a crash in animation related code where weston
would crash in weston_view_animation_create when the
view had no output assigned.
This makes sure that animation gets created and released
immediately, so done and reset callbacks still get called
properly.
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
[Pekka: put a '{' on the right line.]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
parent
96c205a509
commit
75e7106403
1 changed files with 18 additions and 2 deletions
|
|
@ -196,6 +196,14 @@ weston_view_animation_frame(struct weston_animation *base,
|
|||
weston_compositor_schedule_repaint(compositor);
|
||||
}
|
||||
|
||||
static void
|
||||
idle_animation_destroy(void *data)
|
||||
{
|
||||
struct weston_view_animation *animation = data;
|
||||
|
||||
weston_view_animation_destroy(animation);
|
||||
}
|
||||
|
||||
static struct weston_view_animation *
|
||||
weston_view_animation_create(struct weston_view *view,
|
||||
float start, float stop,
|
||||
|
|
@ -206,6 +214,8 @@ weston_view_animation_create(struct weston_view *view,
|
|||
void *private)
|
||||
{
|
||||
struct weston_view_animation *animation;
|
||||
struct weston_compositor *ec = view->surface->compositor;
|
||||
struct wl_event_loop *loop;
|
||||
|
||||
animation = malloc(sizeof *animation);
|
||||
if (!animation)
|
||||
|
|
@ -229,8 +239,14 @@ weston_view_animation_create(struct weston_view *view,
|
|||
animation->listener.notify = handle_animation_view_destroy;
|
||||
wl_signal_add(&view->destroy_signal, &animation->listener);
|
||||
|
||||
wl_list_insert(&view->output->animation_list,
|
||||
&animation->animation.link);
|
||||
if (view->output) {
|
||||
wl_list_insert(&view->output->animation_list,
|
||||
&animation->animation.link);
|
||||
} else {
|
||||
wl_list_init(&animation->animation.link);
|
||||
loop = wl_display_get_event_loop(ec->wl_display);
|
||||
wl_event_loop_add_idle(loop, idle_animation_destroy, animation);
|
||||
}
|
||||
|
||||
return animation;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue