shell: fix resume_desktop for zero clients
Fix two bugs: - if there are no backgrounds at all, the background pointer would have been bogus. Lead to a segfault. - if the hidden_surface_list is empty, wl_list_insert_list() would corrupt the list. Lead to a hang in pick_surface(). Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
committed by
Kristian Høgsberg
parent
65c74cb18b
commit
fe34083023
+12
-5
@@ -518,16 +518,23 @@ static void
|
|||||||
resume_desktop(struct wl_shell *shell)
|
resume_desktop(struct wl_shell *shell)
|
||||||
{
|
{
|
||||||
struct wlsc_surface *surface;
|
struct wlsc_surface *surface;
|
||||||
struct shell_surface *background;
|
struct wl_list *list;
|
||||||
|
|
||||||
wl_list_for_each(surface, &shell->hidden_surface_list, link)
|
wl_list_for_each(surface, &shell->hidden_surface_list, link)
|
||||||
wlsc_surface_configure(surface, surface->x, surface->y,
|
wlsc_surface_configure(surface, surface->x, surface->y,
|
||||||
surface->width, surface->height);
|
surface->width, surface->height);
|
||||||
|
|
||||||
background = container_of(shell->backgrounds.prev,
|
if (wl_list_empty(&shell->backgrounds)) {
|
||||||
struct shell_surface, link);
|
list = &shell->compositor->surface_list;
|
||||||
wl_list_insert_list(background->surface->link.prev,
|
} else {
|
||||||
&shell->hidden_surface_list);
|
struct shell_surface *background;
|
||||||
|
background = container_of(shell->backgrounds.prev,
|
||||||
|
struct shell_surface, link);
|
||||||
|
list = background->surface->link.prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!wl_list_empty(&shell->hidden_surface_list))
|
||||||
|
wl_list_insert_list(list, &shell->hidden_surface_list);
|
||||||
wl_list_init(&shell->hidden_surface_list);
|
wl_list_init(&shell->hidden_surface_list);
|
||||||
|
|
||||||
shell->locked = false;
|
shell->locked = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user