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
This commit is contained in:
Georges Basile Stavracas Neto 2018-11-27 12:10:45 -02:00
parent a05cb76e0d
commit 5880758709

View File

@ -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;
}