[gnome-shell/gnome-3-28] workspace: Fix infinite loop when finding parent window of dialogs



commit d08497414f931d8726599388a735c421b9a49f3c
Author: verdre <gitlab v0yd nl>
Date:   Mon Jul 23 12:22:34 2018 +0000

    workspace: Fix infinite loop when finding parent window of dialogs
    
    When a dialog is added to a window while the overview is shown, we get
    its parent using get_transient_for() so we can add it to the right
    window clone.
    
    If we have multiple layers of dialogs we have to do this recursively
    until we find the root ancestor. This case currently results in an
    infinite loop: Since parent is always set to the same window, the
    while-condition will always be true.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/180
    
    
    (cherry picked from commit 52cbc299a795b4573a7558982115354cfa7a4e61)

 js/ui/workspace.js          | 2 +-
 js/ui/workspaceThumbnail.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 112c54e8c..1a230068e 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -1507,7 +1507,7 @@ var Workspace = new Lang.Class({
             if (metaWin.is_attached_dialog()) {
                 let parent = metaWin.get_transient_for();
                 while (parent.is_attached_dialog())
-                    parent = metaWin.get_transient_for();
+                    parent = parent.get_transient_for();
 
                 let idx = this._lookupIndex (parent);
                 if (idx < 0) {
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index eda5dc38a..4aafcd378 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -416,7 +416,7 @@ var WorkspaceThumbnail = new Lang.Class({
         } else if (metaWin.is_attached_dialog()) {
             let parent = metaWin.get_transient_for();
             while (parent.is_attached_dialog())
-                parent = metaWin.get_transient_for();
+                parent = parent.get_transient_for();
 
             let idx = this._lookupIndex (parent);
             if (idx < 0) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]