Bugzilla – Bug 8539
playerCurrent notifications sent early
Last modified: 2008-08-04 14:06:02 UTC
this appears to be a new bug since the SlimDiscovery refactoring... SetupNetTestMeta.lua uses a jnt subscription to decide when it places/removes the "Network Test" menu item. The first issue seems to be that SlimDiscovery sends a playerConnected notification out when it reads the player that it has in its settings.lua file...this seems incorrect, as that player isn't really connected until it's...well, connected. Secondly, there doesn't seem to be any way of predicting when the notify_playerConnected() function in SetupNetTestMeta.lua will actually get called, if ever. What's really odd is that it appears that if jiveMain:addItem() is called in registerApplet(), then the playerConnected notification triggers the notify_playerConnected() method. If not, the method appears to never get called after a playerConnected notification. Very puzzling. Haven't looked at it yet, but my hunch is that this bug is the root cause of bug#8530.
Ben, SlimDiscovery should not call playerConnected at start, but playerCurrent. Please take a look and send me a patch so I can see what went wrong (I spent a lot of time testing this, so I am surprised at this error). The problem with the notifications is due to a change I made in the jnt. The subscriptions are now stored in a weak table, so if the callback does out of scope it will be GC'd. See r2558 for the cause and r2565 for fixes in other applets. It would be worth you having a quick read of the checkins in the discovery-refactor branch if you have not already.
Created attachment 3502 [details] patch to create oldInfo table that's not just a ref to self.info IMO, this is what's required for this fix.
(patch on this bug is rubbish) r2640 (and a typo fix in r2641) has a fix for problem in the SetupNetworkTestMeta.lua file one strange quirk that I've worked around is that if the menu item isn't added in registerApplet, the notify_playerCurrent method in the meta file doesn't get called when playerCurrent notifications go out. I got around this by adding the item to the 'hidden' node in homeMenu, then expose it/hide it as needed with the setNode method. Seems to work just fine, including when disconnecting from player with press-hold left.
This bug has now been fixed in the 7.1 release version of SqueezeCenter! Please download the new version from http://www.slimdevices.com if you haven't already. If you are still experiencing this problem, feel free to reopen the bug with your new comments and we'll have another look.