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
=== modified file 'src/Wallpaper.vala'
--- src/Wallpaper.vala 2014-03-13 17:16:53 +0000
+++ src/Wallpaper.vala 2014-10-21 20:31:40 +0000
@@ -25,11 +25,11 @@
25 */25 */
26public class Wallpaper : Clutter.Group {26public class Wallpaper : Clutter.Group {
27 /**27 /**
28 * 28 *
29 */29 */
30 List<GtkClutter.Texture> wallpapers = new List<GtkClutter.Texture> ();30 List<GtkClutter.Texture> wallpapers = new List<GtkClutter.Texture> ();
31 List<Cancellable> loading_wallpapers = new List<Cancellable> ();31 List<Cancellable> loading_wallpapers = new List<Cancellable> ();
32 32
33 /**33 /**
34 * Contains old Textures that were used for wallpapers. They are recycled34 * Contains old Textures that were used for wallpapers. They are recycled
35 * in the @make_texture method.35 * in the @make_texture method.
@@ -118,6 +118,9 @@
118 }118 }
119 wallpapers.append (new_wallpaper);119 wallpapers.append (new_wallpaper);
120120
121 } catch (IOError.CANCELLED e) {
122 message (@"Cancelled to load '$path'");
123 // do nothing, we cancelled on purpose
121 } catch (Error e) {124 } catch (Error e) {
122 if (get_default() != path) {125 if (get_default() != path) {
123 set_wallpaper (get_default ());126 set_wallpaper (get_default ());

Subscribers

People subscribed via source and target branches