dnd: Handle dragActorSource getting destroyed

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2318>
This commit is contained in:
Jonas Dreßler 2022-04-10 18:47:25 +02:00 committed by Marge Bot
parent 628866f7d2
commit de08ec915f

View File

@ -367,6 +367,10 @@ var _Draggable = class _Draggable extends Signals.EventEmitter {
y = stageY - this._dragActor.height / 2;
}
this._dragActor.set_position(x, y);
this._dragActorSourceDestroyId = this._dragActorSource.connect('destroy', () => {
this._dragActorSource = null;
});
} else {
this._dragActorSource = this.actor;
}
@ -799,6 +803,11 @@ var _Draggable = class _Draggable extends Signals.EventEmitter {
this._dragOrigParent = null;
}
if (this._dragActorSource) {
this._dragActorSource.disconnect(this._dragActorSourceDestroyId);
this._dragActorSource = null;
}
this._dragState = DragState.INIT;
currentDraggable = null;
}