From de08ec915fd3de1bfd6488f14e0c8f8ae7250701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Sun, 10 Apr 2022 18:47:25 +0200 Subject: [PATCH] dnd: Handle dragActorSource getting destroyed Part-of: --- js/ui/dnd.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/ui/dnd.js b/js/ui/dnd.js index 125024204..63ce5a020 100644 --- a/js/ui/dnd.js +++ b/js/ui/dnd.js @@ -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; }