File gnome-shell-1127231-workspace-JS-invalid-access.patch of Package gnome-shell.10843

From f8427c8069012a842390941080ea709e6e0f8238 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Fri, 29 Jun 2018 11:21:59 +0200
Subject: workspaceThumbnail: remove unused private win reference

---
 js/ui/workspaceThumbnail.js | 2 --
 1 file changed, 2 deletions(-)

diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index f5f691320..8b87bd3f9 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -370,8 +370,6 @@ var WorkspaceThumbnail = new Lang.Class({
     },
 
     _doRemoveWindow : function(metaWin) {
-        let win = metaWin.get_compositor_private();
-
         // find the position of the window in our list
         let index = this._lookupIndex (metaWin);
 
-- 
2.16.4


From e02b9ee8678beb47a0cbb54e8077a7f64e3af3f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Mon, 9 Jul 2018 11:50:25 +0200
Subject: workspace: Don't keep stale clones in list

If a clone gets destroyed before the corresponding MetaWindow is
removed from the workspace, we will still find it in the list of
clones and try to destroy it again. Avoid the resulting warnings
by updating the list of clones immediately when a clone is destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=791233
---
 js/ui/workspace.js | 61 ++++++++++++++++++++++++++++++------------------------
 1 file changed, 34 insertions(+), 27 deletions(-)

diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index a64cf7dec..2f07d0a61 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -1432,34 +1432,26 @@ var Workspace = new Lang.Class({
     _doRemoveWindow : function(metaWin) {
         let win = metaWin.get_compositor_private();
 
-        // find the position of the window in our list
-        let index = this._lookupIndex (metaWin);
-
-        if (index == -1)
-            return;
-
-        let clone = this._windows[index];
-
-        this._windows.splice(index, 1);
-        this._windowOverlays.splice(index, 1);
-
-        // If metaWin.get_compositor_private() returned non-NULL, that
-        // means the window still exists (and is just being moved to
-        // another workspace or something), so set its overviewHint
-        // accordingly. (If it returned NULL, then the window is being
-        // destroyed; we'd like to animate this, but it's too late at
-        // this point.)
-        if (win) {
-            let [stageX, stageY] = clone.actor.get_transformed_position();
-            let [stageWidth, stageHeight] = clone.actor.get_transformed_size();
-            win._overviewHint = {
-                x: stageX,
-                y: stageY,
-                scale: stageWidth / clone.actor.width
-            };
+        let clone = this._removeWindowClone(metaWin);
+
+        if (clone) {
+            // If metaWin.get_compositor_private() returned non-NULL, that
+            // means the window still exists (and is just being moved to
+            // another workspace or something), so set its overviewHint
+            // accordingly. (If it returned NULL, then the window is being
+            // destroyed; we'd like to animate this, but it's too late at
+            // this point.)
+            if (win) {
+                let [stageX, stageY] = clone.actor.get_transformed_position();
+                let [stageWidth, stageHeight] = clone.actor.get_transformed_size();
+                win._overviewHint = {
+                    x: stageX,
+                    y: stageY,
+                    scale: stageWidth / clone.actor.width
+                };
+            }
+            clone.destroy();
         }
-        clone.destroy();
-
 
         // We need to reposition the windows; to avoid shuffling windows
         // around while the user is interacting with the workspace, we delay
@@ -1857,6 +1849,10 @@ var Workspace = new Lang.Class({
                       Lang.bind(this, function() {
                           this._recalculateWindowPositions(WindowPositionFlags.NONE);
                       }));
+        clone.actor.connect('destroy',
+                      Lang.bind(this, function() {
+                          this._removeWindowClone(clone.metaWindow);
+                      }));
 
         this.actor.add_actor(clone.actor);
 
@@ -1873,6 +1869,17 @@ var Workspace = new Lang.Class({
         return [clone, overlay];
     },
 
+  _removeWindowClone: function (metaWin) {
+        // find the position of the window in our list
+        let index = this._lookupIndex (metaWin);
+
+        if (index == -1)
+            return null;
+
+        this._windowOverlays.splice(index, 1);
+        return this._windows.splice(index, 1).pop();
+    },
+
     _onShowOverlayClose: function (windowOverlay) {
         for (let i = 0; i < this._windowOverlays.length; i++) {
             let overlay = this._windowOverlays[i];
-- 
2.16.4


From 9709e3c31743ed8dabd03865cd95f519081cb544 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Mon, 9 Jul 2018 12:19:00 +0200
Subject: workspaceThumbnail: Don't keep stale clones in list

If a clone gets destroyed before the corresponding MetaWindow is
removed from the workspace, we will still find it in the list of
clones and try to destroy it again. Avoid the resulting warnings
by updating the list of clones immediately when a clone is destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=791233
---
 js/ui/workspaceThumbnail.js | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 8b87bd3f9..76cab4096 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -370,16 +370,9 @@ var WorkspaceThumbnail = new Lang.Class({
     },
 
     _doRemoveWindow : function(metaWin) {
-        // find the position of the window in our list
-        let index = this._lookupIndex (metaWin);
-
-        if (index == -1)
-            return;
-
-        let clone = this._windows[index];
-        this._windows.splice(index, 1);
-
-        clone.destroy();
+        let clone = this._removeWindowClone(metaWin);
+        if (clone)
+            clone.destroy();
     },
 
     _doAddWindow : function(metaWin) {
@@ -537,6 +530,10 @@ var WorkspaceThumbnail = new Lang.Class({
                       Lang.bind(this, function() {
                           Main.overview.endWindowDrag(clone.metaWindow);
                       }));
+        clone.actor.connect('destroy',
+                      Lang.bind(this, function() {
+                          this._removeWindowClone(clone.metaWindow);
+                      }));
         this._contents.add_actor(clone.actor);
 
         if (this._windows.length == 0)
@@ -549,6 +546,16 @@ var WorkspaceThumbnail = new Lang.Class({
         return clone;
     },
 
+    _removeWindowClone : function (metaWin) {
+        // find the position of the window in our list
+        let index = this._lookupIndex (metaWin);
+
+        if (index == -1)
+            return null;
+
+        return this._windows.splice(index, 1).pop();
+    },
+
     activate : function (time) {
         if (this.state > ThumbnailState.NORMAL)
             return;
-- 
2.16.4
openSUSE Build Service is sponsored by