Comment 41 for bug 1335492

Revision history for this message
In , Thomas Schweikle (tps) wrote :

https://bugs.launchpad.net/ubuntu/+source/xfdesktop4/+bug/1335492

This bug seems to be a race condition: xfce config files and desktop directory are read in parallel.
At first no icon positions are known. The first icons are placed by default, from top-left down to bottom-left.
Then, since the config file reading is slightly faster, than desktop directory reading, some icon positions are known and these are placed as expected.
Sometimes reading an icon position and reading the accompanying file might overlap: first the file is read, then the icon is placed at default, but slightly later it is placed at the expected position. Don't know how this happens, but it results in an event "icon moved" forcing the all icons already placed to be written to config files, overwriting the config file and reading it in again. This leads to loosing all icon positions not read from desktop directory. When these are found they are placed by default: top-left to bottom-left.
At very last, when all files in Desktop are placed the config file is written again (since there where "new" icons).

Simple way to confirm what is going on: place your icons you'd like to have them, then:

chmod 0444 ${HOME}/.config/xfce4/desktop/icons.screen0-<hsize>x<vsize>.rc
chmod 0555 ${HOME}/.config/xfce4/desktop
chown -R root ${HOME}/.config/xfce4

then restart. Depending how many background apps you run, you might find your desktop resorted with all icons in default order: top-left to bottom-left, filling the screen from left to right.
Log off, then on again. This time (since the config file couldn't be written) the icons will be sorted as given in the config file. Why?
Simple: restarting the system requires to load all libraries your background apps need, logging off and on again these are loaded already. Result: the first time you start your desktop the race is open: it depends on who wins: sometimes its the part reading the config file, sometimes it the part reading the desktop directory.
In case of log off and on reading the config file is normally much faster than reading the directory, thus all icons are placed as expected, because there positions are known, as they are read from "Desktop".

Conclusion: making sure the config file is fully read *before* "Desktop" reading starts might solve the problem ...