Merge lp:~teemperor/pantheon-greeter/fix-first-wallpaper-fails-to-show into lp:~elementary-pantheon/pantheon-greeter/trunk

Proposed by Raphael Isemann
Status: Merged
Approved by: Cody Garver
Approved revision: 318
Merged at revision: 328
Proposed branch: lp:~teemperor/pantheon-greeter/fix-first-wallpaper-fails-to-show
Merge into: lp:~elementary-pantheon/pantheon-greeter/trunk
Diff against target: 27 lines (+5/-2)
1 file modified
src/Wallpaper.vala (+5/-2)
To merge this branch: bzr merge lp:~teemperor/pantheon-greeter/fix-first-wallpaper-fails-to-show
Reviewer Review Type Date Requested Status
elementary Pantheon team Pending
Review via email: mp+239134@code.launchpad.net

Commit message

Correctly ignore Exceptions due to cancelled loading. This prevents multiple load-calls that close behind each other from aborting each other, thus causing the default wallpaper to load.

Description of the change

There is a race-condition in the loading-code. When the same background is loaded twice in a short period, the second loading-attempt cancels the first. This causes the the first-loading attempt to reach the catch-block and will start to load the backup-wallpaper. The attempt to load the backup-wallpaper will then cancel the second attempt and we only see the default-wallpaper.

The reason for the catch-block was that we use the fallback in case we can't load the actual wallpaper. However, cancelling a operation also causes a exception and the current code assumes that there was an actual error with the wallpaper, but instead he should just stop loading.

This patch will catch the CANCELLED-Errors and will not start to load the default-wallpaper in this case (which is the correct behaviour and prevents the race-condition).

To post a comment you must log in.
Revision history for this message
Raphael Isemann (teemperor) wrote :

Important: The switchboard-plug-pantheon is a bit broken and is not informing accountsservices about your wallpaper. So you have to use the set-wallpaper-contract of files to set your background before testing this!.

Revision history for this message
Gero.Bare (gero-bare) wrote :

Yeah, that worked!.

To activate that service use dconf-editor
go to: org > gnome> settings-daemon > plugins> background
there check Active.

Worked in Freya.

I was trying to make a patch for switchboar-plug-pantheon-shell to solve that problem.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Wallpaper.vala'
2--- src/Wallpaper.vala 2014-03-13 17:16:53 +0000
3+++ src/Wallpaper.vala 2014-10-21 20:31:40 +0000
4@@ -25,11 +25,11 @@
5 */
6 public class Wallpaper : Clutter.Group {
7 /**
8- *
9+ *
10 */
11 List<GtkClutter.Texture> wallpapers = new List<GtkClutter.Texture> ();
12 List<Cancellable> loading_wallpapers = new List<Cancellable> ();
13-
14+
15 /**
16 * Contains old Textures that were used for wallpapers. They are recycled
17 * in the @make_texture method.
18@@ -118,6 +118,9 @@
19 }
20 wallpapers.append (new_wallpaper);
21
22+ } catch (IOError.CANCELLED e) {
23+ message (@"Cancelled to load '$path'");
24+ // do nothing, we cancelled on purpose
25 } catch (Error e) {
26 if (get_default() != path) {
27 set_wallpaper (get_default ());

Subscribers

People subscribed via source and target branches