[gnome-shell/T27795: 1/138] dnd: Don't try to destroy undefined drag actor



commit 0b6ab0a79ca4216d03ca237ab566ac5d9fbc7db5
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Nov 27 12:10:45 2018 -0200

    dnd: Don't try to destroy undefined drag actor
    
    Draggable._dragComplete() sets this._dragActor to undefined. Right
    after calling Draggable._dragComplete() in _cancelDrag(), though,
    it tries to destroy this._dragActor, which is undefined.
    
    Fix that by storing the current drag actor before calling into
    _dragComplete(), and using it after.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/744

 js/ui/dnd.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 786d654199..e27c3691fd 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -642,12 +642,13 @@ var _Draggable = class _Draggable {
         this._dragState = DragState.CANCELLED;
 
         if (this._actorDestroyed || wasCancelled) {
+            let dragActor = this._dragActor;
             global.display.set_cursor(Meta.Cursor.DEFAULT);
             if (!this._buttonDown)
                 this._dragComplete();
             this.emit('drag-end', eventTime, false);
-            if (!this._dragOrigParent && this._dragActor)
-                this._dragActor.destroy();
+            if (!this._dragOrigParent && dragActor)
+                dragActor.destroy();
 
             return;
         }


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