appIcon: Remove drag monitor on destroy

It may happen that the app icon is destroyed with a drag
monitor still around, in which case, a load of warnings
will be shown.

Make sure to remove any pending drag monitor on destroy.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/841
This commit is contained in:
Georges Basile Stavracas Neto 2019-11-21 18:50:11 -03:00
parent bd173ac5d2
commit e7b9bd75d8

View File

@ -2133,6 +2133,7 @@ var AppIcon = GObject.registerClass({
}); });
} }
this._dragMonitor = null;
this._itemDragBeginId = Main.overview.connect( this._itemDragBeginId = Main.overview.connect(
'item-drag-begin', this._onDragBegin.bind(this)); 'item-drag-begin', this._onDragBegin.bind(this));
this._itemDragEndId = Main.overview.connect( this._itemDragEndId = Main.overview.connect(
@ -2157,6 +2158,12 @@ var AppIcon = GObject.registerClass({
} }
if (this._stateChangedId > 0) if (this._stateChangedId > 0)
this.app.disconnect(this._stateChangedId); this.app.disconnect(this._stateChangedId);
if (this._dragMonitor) {
DND.removeDragMonitor(this._dragMonitor);
this._dragMonitor = null;
}
if (this._draggable) { if (this._draggable) {
if (this._dragging) if (this._dragging)
Main.overview.endItemDrag(this); Main.overview.endItemDrag(this);