From 4f3de2ce399830ab9690d524d88d71008a4b342b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 29 Sep 2014 23:02:02 +0200 Subject: [PATCH] workspace: Correctly initialize MRU list The workspace MRU lists are updated when windows are managed/unmanaged or change workspaces. However those updates obviously only apply to existing workspaces - new workspaces will always start out with an empty MRU list, despite sticky windows already being "on" that workspace. As we now assert that the list contains all windows located on the workspace, we need to initialize it correctly to avoid a crash. https://bugzilla.gnome.org/show_bug.cgi?id=737581 --- src/core/workspace.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/workspace.c b/src/core/workspace.c index 2248f7072..e9e7563e8 100644 --- a/src/core/workspace.c +++ b/src/core/workspace.c @@ -170,6 +170,7 @@ MetaWorkspace* meta_workspace_new (MetaScreen *screen) { MetaWorkspace *workspace; + GSList *windows, *l; workspace = g_object_new (META_TYPE_WORKSPACE, NULL); @@ -179,6 +180,13 @@ meta_workspace_new (MetaScreen *screen) workspace->windows = NULL; workspace->mru_list = NULL; + /* make sure sticky windows are in our mru_list */ + windows = meta_display_list_windows (screen->display, META_LIST_SORTED); + for (l = windows; l; l = l->next) + if (meta_window_located_on_workspace (l->data, workspace)) + meta_workspace_add_window (workspace, l->data); + g_slist_free (windows); + workspace->work_areas_invalid = TRUE; workspace->work_area_monitor = NULL; workspace->work_area_screen.x = 0;