summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2018-01-23 11:43:09 +0100
committerOlivier Fourdan <ofourdan@redhat.com>2018-01-25 10:47:44 +0100
commitfbd5a74a0b3b8af3a263021058b9b37c19fdc15e (patch)
treecd3edb7857dc101e0eb29e0c14aaf0e0ab5f5558 /src
parent58bb61e16179864690f71bee3d8ea34dc05f6ba6 (diff)
downloadmutter-fbd5a74a0b3b8af3a263021058b9b37c19fdc15e.tar.gz
session: use initial workspace if no workspace set
Having “on_all_workspaces_requested” FALSE on a window does not imply a workspace is set. If the X11 window is placed on a secondary monitor while workspaces applies on primary monitor only (“workspaces-only-on-primary” set) then “on_all_workspaces_requested” is FALSE while “on_all_workspaces“ is TRUE and the associated workspace is NULL, leading to a crash when saving the gnome-shell/mutter session. So if no workspace is set, use the “initial_workspace” instead to avoid a NULL pointer dereference. https://bugzilla.gnome.org/show_bug.cgi?id=792818
Diffstat (limited to 'src')
-rw-r--r--src/x11/session.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/x11/session.c b/src/x11/session.c
index af64270a6..8b2a89f1c 100644
--- a/src/x11/session.c
+++ b/src/x11/session.c
@@ -950,7 +950,10 @@ save_state (void)
fputs (" <sticky/>\n", outfile);
} else {
int n;
- n = meta_workspace_index (window->workspace);
+ if (window->workspace)
+ n = meta_workspace_index (window->workspace);
+ else
+ n = window->initial_workspace;
fprintf (outfile,
" <workspace index=\"%d\"/>\n", n);
}