GNOME Bugzilla – Bug 662883
Race Condition setting active source at startup
Last modified: 2011-11-21 20:36:37 UTC
It appears there is a race condition when setting the active source, at startup. We need to do this in the U1MS extension, when a u1ms:// link is passed into banshee. If banshee is already running, this doesn't seem to be an issue, as things are relatively idle. However, at startup, there is a lot more activity happening, and active source notification seems to race with the main loop, sometimes failing, causing the source switch to not happen, or causing the source to switch, but leaving the selected source in the source tree list on the sidebar, to be incorrect. From https://bugs.launchpad.net/ubuntu/+source/banshee/+bug/882732
Fixed in master: http://git.gnome.org/browse/banshee/commit/?id=9323f7b5c056ce52128dd4dfdf5b16abff8fb6e9 Could someone merge this change to banshee-2-2 also? Thanks.
Rodney, normally a person needs a maintainer's review/approval before pushing anything. (Anyway I shouldn't be the one pointing this out.) But more important than anything is that the fix for this seems to have caused bug 662982.
I reverted the commit indicated above, as it was breaking the Amazon store, and possibly other sources : The ActiveSourceChanged event is used amongst others by InterfaceActionService to set up the GUI for the source, so the handlers need to be called before Activate(). This might not be the case if they're called in an idle delegate. But we do have some kind of race on startup, I was able to reproduce the problem: U1MS content was displayed, but it was not selected in the source tree.
Here's what I think is going on : SourceManager first instantiates the U1MS source, then it gets added to the source tree view : http://git.gnome.org/browse/banshee/tree/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs#n131 But the U1MS tries to set itself as the active source in its constructor, so it's not in the source tree view yet. That's why it doesn't get selected. I don't see an easy fix for this right now, so I'm open to suggestions.
Bertrand, rather than try to fix this more generally, I've just gone ahead and put the call in an idle.add inside the u1ms extension itself. So, I'm considering it fixed as well as it's going to be.