Remove timer resource during SignalMgt destructor

This commit is contained in:
Grégory Soutadé 2022-01-06 09:51:13 +01:00
parent 78254a550e
commit 02d3e8b72a

View File

@ -64,6 +64,7 @@ class SignalMgt {
this.menu = menu; this.menu = menu;
this.signals = new WeakMap(); this.signals = new WeakMap();
this.widgets = new Array(); this.widgets = new Array();
this.timeouts = new Array();
this.nbClicks = 0; this.nbClicks = 0;
this.button = -1; this.button = -1;
@ -80,6 +81,8 @@ class SignalMgt {
destructor() { destructor() {
for(let widgetIdx in this.widgets) for(let widgetIdx in this.widgets)
this.disconnectWidgetSignals(this.widgets[widgetIdx]); this.disconnectWidgetSignals(this.widgets[widgetIdx]);
for(let timeoutIdx in this.timeouts)
GLib.Source.remove(this.timeouts[timeoutIdx]);
} }
updateSignals(item) { updateSignals(item) {
@ -168,8 +171,9 @@ class SignalMgt {
this.button = event.get_button(); this.button = event.get_button();
this.nbClicks = 1; this.nbClicks = 1;
Mainloop.timeout_add(this.dbus.ClutterSettings['double-click-time'], let sourceId = Mainloop.timeout_add(this.dbus.ClutterSettings['double-click-time'],
this._doClickCallback.bind(this)); this._doClickCallback.bind(this));
this.timeouts.push(sourceId);
} }
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;