[gnome-shell/wip/fix-drag-lock-up] dnd: don't try to access destroyed dragActor



commit 82c72f377a91cfa75fed1102f92ff4685c7e74da
Author: Ray Strode <rstrode redhat com>
Date:   Wed Sep 19 11:47:35 2018 -0400

    dnd: don't try to access destroyed dragActor
    
    The dragComplete handler incorrectly checks
    this._actorDestroyed to see if the drag actor
    is destroyed.  The drag actor may not be the same
    as the main actor.
    
    The end result is an exception in drop handling,
    leading to a shell lockup.
    
    This commit changes the code to always set
    this._dragActor to undefined when it's destroyed,
    and check for that condition instead of
    this._actorDestroyed in the dragComplete handler.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-shell/issues/577

 js/ui/dnd.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 634a7d6d7..6c563a3ba 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -506,6 +506,7 @@ var _Draggable = new Lang.Class({
                             return true;
                         } else
                             this._dragActor.destroy();
+                            this._dragActor = undefined;
                     }
 
                     this._dragInProgress = false;
@@ -565,8 +566,10 @@ var _Draggable = new Lang.Class({
             if (!this._buttonDown)
                 this._dragComplete();
             this.emit('drag-end', eventTime, false);
-            if (!this._dragOrigParent)
+            if (!this._dragOrigParent) {
                 this._dragActor.destroy();
+                this._dragActor = undefined;
+            }
 
             return;
         }
@@ -634,6 +637,7 @@ var _Draggable = new Lang.Class({
             dragActor.set_position(this._dragOrigX, this._dragOrigY);
         } else {
             dragActor.destroy();
+            this._dragActor = undefined;
         }
 
         this.emit('drag-end', eventTime, false);
@@ -641,7 +645,7 @@ var _Draggable = new Lang.Class({
     },
 
     _dragComplete() {
-        if (!this._actorDestroyed)
+        if (this._dragActor)
             Shell.util_set_hidden_from_pick(this._dragActor, false);
 
         this._ungrabEvents();


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