Compare commits

...

3 Commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
87de09a83e dnd: Finish animation before destroying actor
Otherwise JavaScript aborts the execution of the function
and the drag is never released. That's because _dragComplete
tries to unhide this._dragActor from picking, and that cannot
be done after calling this._dragActor.destroy(), which is
the case now.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/744
2019-09-26 10:32:07 -03:00
Georges Basile Stavracas Neto
b65b4e3cae dnd: Don't mix callback argument and object field usage
This will be important for the next commit, since _dragComplete()
changes the value of this._dragActor and we need to keep a valid
reference to it.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/744
2019-09-26 10:32:07 -03:00
Georges Basile Stavracas Neto
5880758709 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
2019-09-26 10:32:07 -03:00

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;
}
@ -702,17 +703,17 @@ var _Draggable = class _Draggable {
}
_onAnimationComplete(dragActor, eventTime) {
this.emit('drag-end', eventTime, false);
this._finishAnimation();
if (this._dragOrigParent) {
Main.uiGroup.remove_child(this._dragActor);
this._dragOrigParent.add_actor(this._dragActor);
Main.uiGroup.remove_child(dragActor);
this._dragOrigParent.add_actor(dragActor);
dragActor.set_scale(this._dragOrigScale, this._dragOrigScale);
dragActor.set_position(this._dragOrigX, this._dragOrigY);
} else {
dragActor.destroy();
}
this.emit('drag-end', eventTime, false);
this._finishAnimation();
}
_dragComplete() {