Background: ignore cancellation errors

If the request cancellable is cancelled, the requesting background was
destroyed, so don't bother reporting the result.

https://bugzilla.gnome.org/show_bug.cgi?id=694227
This commit is contained in:
Ray Strode 2013-02-20 01:55:56 +01:00
parent 1188b1be36
commit 0122cee0ae

View File

@ -164,6 +164,9 @@ const BackgroundCache = new Lang.Class({
if (candidateContent) { if (candidateContent) {
content = candidateContent.copy(params.monitorIndex, params.effects); content = candidateContent.copy(params.monitorIndex, params.effects);
if (params.cancellable && params.cancellable.is_cancelled())
content = NULL;
if (params.onFinished) if (params.onFinished)
params.onFinished(content); params.onFinished(content);
} else { } else {
@ -264,7 +267,6 @@ const Background = new Lang.Class({
_destroy: function() { _destroy: function() {
this._cancellable.cancel(); this._cancellable.cancel();
this._cancellable = null;
if (this._animationUpdateTimeoutId) { if (this._animationUpdateTimeoutId) {
GLib.source_remove (this._animationUpdateTimeoutId); GLib.source_remove (this._animationUpdateTimeoutId);
@ -458,7 +460,7 @@ const Background = new Lang.Class({
onLoaded: Lang.bind(this, function(animation) { onLoaded: Lang.bind(this, function(animation) {
this._animation = animation; this._animation = animation;
if (!this._animation) { if (!this._animation || this._cancellable.is_cancelled()) {
this._setLoaded(); this._setLoaded();
return; return;
} }
@ -477,8 +479,7 @@ const Background = new Lang.Class({
cancellable: this._cancellable, cancellable: this._cancellable,
onFinished: Lang.bind(this, function(content) { onFinished: Lang.bind(this, function(content) {
if (!content) { if (!content) {
if (this._cancellable && if (!this._cancellable.is_cancelled())
!this._cancellable.is_cancelled())
this._loadAnimation(filename); this._loadAnimation(filename);
return; return;
} }