- Moderator
- #1
Hi
Attached you will find a patch for MyMusicPlayingNow, and a proposal to fix another bug below this text.
Reading up on controltypes, the Wiki states that:
Well, then MyMusicPlayingNow has a bug
Because if refers to a control that has ID 1 (and BTW doesn't exist in B3W in MyMusicPlayingNow.xml). This means that all unused controls need to have a different ID than 1, leaving only 0 as an option.
Either the Wiki is wrong, or the code is.
Look at the source of MyMusicPlayingNow.cs:
And now the source of GUIMusicOverlay.cs:
Going through the skin-files of B3W, I see a LOT of controls with ID 1, and close to none with ID 0.
My fix is simple regarding MyMusicPlayingNow, but someone needs to check the code for similar bugs.
The bug results in close-to-useless messages like this:
Right...the code tries to convert all my images to labels
Browsing the code, I am chocked to see that GUIMusicOverlay not only uses ID1, but also ID 0!!! This means that musicOverlay.xml only, and only! must contain one control with ID 0, and one control with ID 1.
Another source of error-messages found
Attached you will find a patch for MyMusicPlayingNow, and a proposal to fix another bug below this text.
Reading up on controltypes, the Wiki states that:
The id of the control. The id will couple the skin file to the code, so if we later on want to check that a user pressed a button, the id will be required and must be unique. For controls that will never be referenced in the code it is safe to set it to "1"
Well, then MyMusicPlayingNow has a bug
Because if refers to a control that has ID 1 (and BTW doesn't exist in B3W in MyMusicPlayingNow.xml). This means that all unused controls need to have a different ID than 1, leaving only 0 as an option.
Either the Wiki is wrong, or the code is.
Look at the source of MyMusicPlayingNow.cs:
Code:
private enum ControlIDs
{
LBL_CAPTION = 1, [INDENT][INDENT][/INDENT][/INDENT]//<--THIS IS BAD BECAUSE LATER ON:
[SkinControl((int) ControlIDs.LBL_CAPTION)] protected GUILabelControl LblCaption = null; //THIS ID IS USED HERE
And now the source of GUIMusicOverlay.cs:
Code:
[SkinControl(0)] protected GUIImage _videoRectangle = null; //<-- OH NO, AGAIN
[SkinControl(1)] protected GUIImage _thumbImage = null; //<-- OH MY!
Going through the skin-files of B3W, I see a LOT of controls with ID 1, and close to none with ID 0.
My fix is simple regarding MyMusicPlayingNow, but someone needs to check the code for similar bugs.
The bug results in close-to-useless messages like this:
2009-10-15 16:44:28.714116 [ERROR][MPMain]: GUIWindow:OnWindowLoaded id:1
ex:Object of type 'MediaPortal.GUI.Library.GUIImage' cannot be converted to
type 'MediaPortal.GUI.Library.GUILabelControl'. at
System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo
culture, BindingFlags invokeAttr)
at System.Reflection.RtFieldInfo.InternalSetValue(Object obj, Object
value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean
doVisibilityCheck, Boolean doCheckConsistency)
at System.Reflection.RtFieldInfo.InternalSetValue(Object obj, Object
value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean
doVisibilityCheck)
at System.Reflection.RtFieldInfo.SetValue(Object obj, Object value,
BindingFlags invokeAttr, Binder binder, CultureInfo culture)
at MediaPortal.GUI.Library.GUIWindow.OnWindowLoaded()
MediaPortal.GUI.Music.GUIMusicPlayingNow
Right...the code tries to convert all my images to labels
Browsing the code, I am chocked to see that GUIMusicOverlay not only uses ID1, but also ID 0!!! This means that musicOverlay.xml only, and only! must contain one control with ID 0, and one control with ID 1.
Another source of error-messages found