background: Disconnect from 'prepare-for-sleep' signal

This signal connection was keeping Background instances from being
garbage collected.

https://bugzilla.gnome.org/show_bug.cgi?id=777934
This commit is contained in:
Rui Matos 2017-01-30 13:29:13 +01:00
parent 9f6f48025d
commit b1dcea7cf1

View File

@ -254,7 +254,8 @@ const Background = new Lang.Class({
this._loadAnimation(this._animation.file);
}));
LoginManager.getLoginManager().connect('prepare-for-sleep',
let loginManager = LoginManager.getLoginManager();
this._prepareForSleepId = loginManager.connect('prepare-for-sleep',
(lm, aboutToSuspend) => {
if (aboutToSuspend)
return;
@ -283,6 +284,10 @@ const Background = new Lang.Class({
this._clock.disconnect(this._timezoneChangedId);
this._timezoneChangedId = 0;
if (this._prepareForSleepId != 0)
LoginManager.getLoginManager().disconnect(this._prepareForSleepId);
this._prepareForSleepId = 0;
if (this._settingsChangedSignalId != 0)
this._settings.disconnect(this._settingsChangedSignalId);
this._settingsChangedSignalId = 0;