Commit fbd5a74a authored by Olivier Fourdan's avatar Olivier Fourdan

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.
parent 58bb61e1
......@@ -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);
n = window->initial_workspace;
fprintf (outfile,
" <workspace index=\"%d\"/>\n", n);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment