appDisplay: Properly destroy SwipeTracker on destroy
SwipeTracker connects to signals of the stage, but doesn't disconnect on destroy, leaving them hanging and potentially running callbacks for destroyed objects. This is visible when removing a folder by dragging all icons out, and running the swipe gestures, which will produce a bunch of warnings. Explicitly destroy, remove, and disconnect the swipe tracker. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1518>
This commit is contained in:
parent
c9a6424f2e
commit
853644d7fe
@ -217,6 +217,12 @@ var BaseAppView = GObject.registerClass({
|
|||||||
this._parentalControlsManager.disconnect(this._appFilterChangedId);
|
this._parentalControlsManager.disconnect(this._appFilterChangedId);
|
||||||
this._appFilterChangedId = 0;
|
this._appFilterChangedId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this._swipeTracker) {
|
||||||
|
this._swipeTracker.destroy();
|
||||||
|
delete this._swipeTracker;
|
||||||
|
}
|
||||||
|
|
||||||
this._removeDelayedMove();
|
this._removeDelayedMove();
|
||||||
this._disconnectDnD();
|
this._disconnectDnD();
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,8 @@ const TouchpadSwipeGesture = GObject.registerClass({
|
|||||||
this._orientation = Clutter.Orientation.VERTICAL;
|
this._orientation = Clutter.Orientation.VERTICAL;
|
||||||
this._enabled = true;
|
this._enabled = true;
|
||||||
|
|
||||||
global.stage.connect('captured-event::touchpad', this._handleEvent.bind(this));
|
this._stageCaptureEvent =
|
||||||
|
global.stage.connect('captured-event::touchpad', this._handleEvent.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
get enabled() {
|
get enabled() {
|
||||||
@ -125,6 +126,13 @@ const TouchpadSwipeGesture = GObject.registerClass({
|
|||||||
|
|
||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroy() {
|
||||||
|
if (this._stageCaptureEvent) {
|
||||||
|
global.stage.disconnect(this._stageCaptureEvent);
|
||||||
|
delete this._stageCaptureEvent;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const TouchSwipeGesture = GObject.registerClass({
|
const TouchSwipeGesture = GObject.registerClass({
|
||||||
@ -643,4 +651,16 @@ var SwipeTracker = GObject.registerClass({
|
|||||||
this._velocity = 0;
|
this._velocity = 0;
|
||||||
this._state = State.SCROLLING;
|
this._state = State.SCROLLING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroy() {
|
||||||
|
if (this._touchpadGesture) {
|
||||||
|
this._touchpadGesture.destroy();
|
||||||
|
delete this._touchpadGesture;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._touchGesture) {
|
||||||
|
global.stage.remove_action(this._touchGesture);
|
||||||
|
delete this._touchGesture;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user