After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 710756 - Changes to current background wallpaper source image not detected consistently
Changes to current background wallpaper source image not detected consistently
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: background
3.10.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
: 707950 723917 725307 725652 729910 733383 735738 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-10-23 21:00 UTC by MT
Modified: 2014-11-07 10:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
decrement the loop counter after splice (1.90 KB, patch)
2013-12-11 22:36 UTC, Fabrice Bellet
accepted-commit_now Details | Review
count references for monitored files (1.56 KB, patch)
2013-12-11 22:39 UTC, Fabrice Bellet
needs-work Details | Review
add debug information (optional patch) (6.55 KB, patch)
2013-12-11 22:40 UTC, Fabrice Bellet
none Details | Review
background: properly disconnect background manager signals (1.45 KB, patch)
2013-12-11 22:44 UTC, Fabrice Bellet
needs-work Details | Review
background: check is backgroundMenu is null before destroy (1022 bytes, patch)
2013-12-11 22:45 UTC, Fabrice Bellet
none Details | Review
background: when a file changes, remove it from the image cache (1.30 KB, patch)
2014-09-24 20:41 UTC, Owen Taylor
committed Details | Review

Description MT 2013-10-23 21:00:12 UTC
I have for a long time been using a script running as a cron job to download an image to use as my desktop background. The script saves the image to a particular file stored locally, overwriting the last image from the previous day. Since the last couple versions of GNOME at least, the change to the background image file no longer automatically leads to the updating of the desktop background (the preview image in the background properties screen however always picks it up). Now, I have to 'nudge' the change into effect by setting some dconf keys in org.gnome.desktop.background (essentially changing the wallpaper settings and then reverting back).

To test:
Say the image is stored in a file wallpaper.jpg

gsettings set org.gnome.desktop.background picture-uri '<image path>'

The background should now be set to the content of wallpaper.jpg. Now copy a new image file to overwrite wallpaper.jpg.

I would expect the shell to monitor any changes to wallpaper.jpg and instantly update the desktop background when this file changes. However, the background image remains unchanged, despite the file contents having changed.

Doing something like
gsettings set org.gnome.desktop.background picture-uri ''
followed by
gsettings set org.gnome.desktop.background picture-uri '<image path>'

resets the desktop background and correctly shows the updated image. But this step should not be necessary, I believe, which is why I'm reporting it as a bug.
Comment 1 Fabrice Bellet 2013-12-11 22:31:00 UTC
I have the same problem.

The patch from https://git.gnome.org/browse/gnome-shell/commit/?h=gnome-3-8&id=1020d8a0f8523a04d8336b1348388b8b242e414f plus some other patches, that I'll attach to this bug report, are needed for me to have a stable shell, when I stress the background update by (simultaneously) :

  . periodically changing the background by the picture-uri key
  . periodically changing the background by updating the file referenced by picture-uri
  . locking/unlocking the session
  . periodically changing the screen output/size, with xrandr (--output LVDS1/--output VGA1) commands.

I know that the initial patch got reverted after freeze bug reports, but it works for me, and seems needed for the reason given is the commit description.
Comment 2 Fabrice Bellet 2013-12-11 22:36:18 UTC
Created attachment 264016 [details] [review]
decrement the loop counter after splice

calling splice() on the list we're iterating on changes the position of the next elements.
Comment 3 Fabrice Bellet 2013-12-11 22:39:00 UTC
Created attachment 264017 [details] [review]
count references for monitored files
Comment 4 Fabrice Bellet 2013-12-11 22:40:30 UTC
Created attachment 264018 [details] [review]
add debug information (optional patch)
Comment 5 Fabrice Bellet 2013-12-11 22:44:11 UTC
Created attachment 264019 [details] [review]
background: properly disconnect background manager signals

this patch fixes the case of a null bgManager.background in the 'changed' callback.
Comment 6 Fabrice Bellet 2013-12-11 22:45:14 UTC
Created attachment 264020 [details] [review]
background: check is backgroundMenu is null before destroy
Comment 7 Jasper St. Pierre (not reading bugmail) 2013-12-12 19:48:07 UTC
Review of attachment 264016 [details] [review]:

Yes.
Comment 8 Jasper St. Pierre (not reading bugmail) 2013-12-12 19:48:56 UTC
Review of attachment 264017 [details] [review]:

I have an alternate fix for this that I like better...

::: js/ui/background.js
@@ -108,3 @@
 
-                                           monitor.disconnect(signalId);
-

Unrelated and bad change.
Comment 9 Jasper St. Pierre (not reading bugmail) 2013-12-12 19:49:40 UTC
Review of attachment 264019 [details] [review]:

Don't insert private properties into instances owned by somebody else.
Comment 10 Jasper St. Pierre (not reading bugmail) 2013-12-12 19:50:10 UTC
Review of attachment 264020 [details] [review]:

Why is this necessary?
Comment 11 Fabrice Bellet 2013-12-17 14:51:37 UTC
(In reply to comment #8)
> Review of attachment 264017 [details] [review]:
> 
> I have an alternate fix for this that I like better...
> 
> ::: js/ui/background.js
> @@ -108,3 @@
> 
> -                                           monitor.disconnect(signalId);
> -
> 
> Unrelated and bad change.

I think the signal should not be disconnected here, because the monitoring signal per file is created only once, and if we disconnect it the first time the file is modified on disk, we won't see the next modifications of the same file ?
Comment 12 Fabrice Bellet 2013-12-17 14:54:04 UTC
Comment on attachment 264020 [details] [review]
background: check is backgroundMenu is null before destroy

I couldn't reproduce the error that made me write this patch, so I propose to ignore it.
Comment 13 Fabrice Bellet 2013-12-17 14:55:44 UTC
Comment on attachment 264019 [details] [review]
background: properly disconnect background manager signals

I also propose to discard this patch for the same reason : I could not reproduce the related error.
Comment 14 majod 2014-04-02 15:32:58 UTC
Hello, I can confirm this bug simply with Firefox browser. In Gnome 3.10, when setting desktop background from Firefox - right click on an image - Set as Desktop Background, the browser creates a file named "Firefox_wallpaper.png" in user's home folder and the background is changed.

When setting a different image as a desktop background from Firefox, the browser simply overwrites the image file but the background stays the same, it does not change for the new one. When opening the file in the Image Viewer and "Set as Wallpaper", the Image viewer notifies that "The image "Firefox..." has been set as desktop background...", but the background does not change at all.

The only way to update the wallpaper is either restarting the Gnome session (altF2r) or logging out and logging back in.
Comment 15 Magdalen Berns (irc magpie) 2014-04-07 21:20:54 UTC
Review of attachment 264016 [details] [review]:

should someone push this?
Comment 16 Fabrice Bellet 2014-09-24 20:11:35 UTC
Hi!

Since bug #735638, the background code changed a lot (between 3.13.91 and 3.13.92), and the pending patch no longer applies.

However, this bug is still there : a modification of the background file on the filesystem triggers a 'changed' event in BackgroundFile.monitorFile, but the change is not propagated on screen. (just tested on Fedora-21-alpha, with gnome 3.13.92 rpms)
Comment 17 Owen Taylor 2014-09-24 20:41:26 UTC
Created attachment 287012 [details] [review]
background: when a file changes, remove it from the image cache

MetaBackgroundCache doesn't itself use file watches, so when a image
that we are monitoring changes we need to purge it from the cache,
so that when we load it again we get the new image.
Comment 18 Florian Müllner 2014-09-24 21:02:47 UTC
Review of attachment 287012 [details] [review]:

::: js/ui/background.js
@@ +301,3 @@
                                            Lang.bind(this, function(cache, changedFile) {
                                                if (changedFile == filename) {
+                                                   let cache = Meta.BackgroundImageCache.get_default();

Can you pick a different name (metaCache?) that doesn't shadow the function parameter?
Comment 19 Fabrice Bellet 2014-09-24 21:21:20 UTC
The patch works for me. Thanks!
Comment 20 Owen Taylor 2014-09-25 03:06:58 UTC
Changed cache=>imageCache and pushed.

Attachment 287012 [details] pushed as 50ac1dd - background: when a file changes, remove it from the image cache
Comment 21 Bastien Nocera 2014-11-07 09:35:33 UTC
*** Bug 707950 has been marked as a duplicate of this bug. ***
Comment 22 Bastien Nocera 2014-11-07 10:17:55 UTC
*** Bug 723917 has been marked as a duplicate of this bug. ***
Comment 23 Bastien Nocera 2014-11-07 10:24:27 UTC
*** Bug 725307 has been marked as a duplicate of this bug. ***
Comment 24 Bastien Nocera 2014-11-07 10:26:49 UTC
*** Bug 725652 has been marked as a duplicate of this bug. ***
Comment 25 Bastien Nocera 2014-11-07 10:33:14 UTC
*** Bug 733383 has been marked as a duplicate of this bug. ***
Comment 26 Bastien Nocera 2014-11-07 10:37:26 UTC
*** Bug 729910 has been marked as a duplicate of this bug. ***
Comment 27 Bastien Nocera 2014-11-07 10:41:13 UTC
*** Bug 735738 has been marked as a duplicate of this bug. ***