Blob Blame History Raw
From a95ae4d178e9dba911c01de53f372f18be34df47 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Thu, 15 Oct 2015 15:35:33 +0200
Subject: [PATCH] session: Fix crash when saving sticky windows

Since commit 527c53a2a058, window->workspace is set to %NULL when
the window is sticky (see comment[0]), so don't try to save the
workspace index in that case.

[0] https://git.gnome.org/browse/mutter/tree/src/core/window.c#n4307

https://bugzilla.gnome.org/show_bug.cgi?id=756642
---
 src/x11/session.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/x11/session.c b/src/x11/session.c
index 6f68729..13cf764 100644
--- a/src/x11/session.c
+++ b/src/x11/session.c
@@ -946,7 +946,15 @@ save_state (void)
 
           /* Sticky */
           if (window->on_all_workspaces_requested)
-            fputs ("    <sticky/>\n", outfile);
+            {
+              fputs ("    <sticky/>\n", outfile);
+            } else {
+              int n;
+              n = meta_workspace_index (window->workspace);
+              fprintf (outfile,
+                       "    <workspace index=\"%d\"/>\n", n);
+            }
+
 
           /* Minimized */
           if (window->minimized)
@@ -963,14 +971,6 @@ save_state (void)
                        window->saved_rect.height);
             }
 
-          /* Workspaces we're on */
-          {
-            int n;
-            n = meta_workspace_index (window->workspace);
-            fprintf (outfile,
-                     "    <workspace index=\"%d\"/>\n", n);
-          }
-
           /* Gravity */
           {
             int x, y, w, h;
-- 
2.5.0