background: Disconnect settings signal handler on destroy
We connect to the changed signal in _init() but never actually disconnect from it. The callback has a reference to "this" which results into the background object not getting garbage collected. Fix that leaks by disconnecting in _destroy() https://bugzilla.gnome.org/show_bug.cgi?id=709263
This commit is contained in:
parent
41acb5d3cc
commit
8b0e846e0e
@ -319,9 +319,9 @@ const Background = new Lang.Class({
|
|||||||
this._cancellable = new Gio.Cancellable();
|
this._cancellable = new Gio.Cancellable();
|
||||||
this.isLoaded = false;
|
this.isLoaded = false;
|
||||||
|
|
||||||
this._settings.connect('changed', Lang.bind(this, function() {
|
this._settingsChangedSignalId = this._settings.connect('changed', Lang.bind(this, function() {
|
||||||
this.emit('changed');
|
this.emit('changed');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this._load();
|
this._load();
|
||||||
},
|
},
|
||||||
@ -362,6 +362,10 @@ const Background = new Lang.Class({
|
|||||||
|
|
||||||
this.actor.disconnect(this._destroySignalId);
|
this.actor.disconnect(this._destroySignalId);
|
||||||
this._destroySignalId = 0;
|
this._destroySignalId = 0;
|
||||||
|
|
||||||
|
if (this._settingsChangedSignalId != 0)
|
||||||
|
this._settings.disconnect(this._settingsChangedSignalId);
|
||||||
|
this._settingsChangedSignalId = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setLoaded: function() {
|
_setLoaded: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user