From 07b2606c7a2ba785b7281d58a58b20cc9172c3ab Mon Sep 17 00:00:00 2001 From: Alex Wu Date: Mon, 12 Mar 2012 16:06:01 +0800 Subject: [PATCH] shell: Fix 2 switcher crashes. In case of no regular window, switcher will crash in switch_next() due to "next == NULL" and in switcher_destroy() due to "switcher->current == NULL". --- src/shell.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shell.c b/src/shell.c index 765b0a433..b294c205e 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1840,6 +1840,9 @@ switcher_next(struct switcher *switcher) if (next == NULL) next = first; + if (next == NULL) + return; + wl_list_remove(&switcher->listener.link); wl_list_insert(next->surface.resource.destroy_listener_list.prev, &switcher->listener.link); @@ -1871,7 +1874,8 @@ switcher_destroy(struct switcher *switcher, uint32_t time) weston_surface_damage(surface); } - activate(compositor->shell, switcher->current, device, time); + if (switcher->current) + activate(compositor->shell, switcher->current, device, time); wl_list_remove(&switcher->listener.link); wl_input_device_end_keyboard_grab(&device->input_device, time); free(switcher);