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 662883 - Race Condition setting active source at startup
Race Condition setting active source at startup
Status: RESOLVED FIXED
Product: banshee
Classification: Other
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Banshee Maintainers
Banshee Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-10-27 19:06 UTC by Rodney Dawes
Modified: 2011-11-21 20:36 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Rodney Dawes 2011-10-27 19:06:28 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
Comment 1 Rodney Dawes 2011-10-27 20:01:21 UTC
Fixed in master: http://git.gnome.org/browse/banshee/commit/?id=9323f7b5c056ce52128dd4dfdf5b16abff8fb6e9

Could someone merge this change to banshee-2-2 also? Thanks.
Comment 2 Andrés G. Aragoneses (IRC: knocte) 2011-10-30 20:46:30 UTC
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.
Comment 3 Bertrand Lorentz 2011-11-01 12:46:03 UTC
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.
Comment 4 Bertrand Lorentz 2011-11-01 13:50:51 UTC
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.
Comment 5 Rodney Dawes 2011-11-21 20:36:37 UTC
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.