[confirm] CTD on GUIDialogSetRating (window ID 2013) (1 Viewer)

pilehave

Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    Hi

    Using Titan skin, when I try to rate a movie in the HeadWeb-plugin, the GUIDialogSetRating window(ID 2013) is called. the window appears, but when I push "down" button to go to the "OK" button (ID 12) MP crashes to desktop, with these last lines in the log:

    Code:
    [2013-05-19 11:46:22,693] [Log	] [MPMain  ] [DEBUG] - WindowManager: route HeadWeb.HeadWebMovieInfo:7772->MediaPortal.Dialogs.GUIDialogSetRating:2013
    [2013-05-19 11:46:22,693] [Log	] [MPMain  ] [DEBUG] - DialogWindow: MediaPortal.Dialogs.GUIDialogSetRating init

    This has never been an issue before in other versions of MP or in other skins, but I'm trying to add support for Titan in my nex release of HeadWeb.
     

    ncoH

    Retired Team Member
  • Premium Supporter
  • January 27, 2007
    925
    1,569
    Hannover
    Home Country
    Germany Germany
    Just tested with myMusic. Everything is fine here. No crash.

    Code:
    [2013-05-19 21:47:44,198] [Log	] [MPMain  ] [DEBUG] - WindowManager: unroute to MediaPortal.Dialogs.GUIDialogMenu:2012->MediaPortal.GUI.Music.GUIMusicGenres:504
    [2013-05-19 21:47:44,218] [Log	] [MPMain  ] [DEBUG] - WindowManager: route MediaPortal.GUI.Music.GUIMusicGenres:504->MediaPortal.Dialogs.GUIDialogSetRating:2013
    [2013-05-19 21:47:44,228] [Log	] [MPMain  ] [DEBUG] - DialogWindow: MediaPortal.Dialogs.GUIDialogSetRating init
    [2013-05-19 21:47:51,651] [Log	] [MPMain  ] [DEBUG] - WindowManager: unroute to MediaPortal.Dialogs.GUIDialogSetRating:2013->MediaPortal.GUI.Music.GUIMusicGenres:504
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    @pilehave I guess this is fine with other skins?
    Can you post the code you are using at this point to call the dialog?
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #5
    Well, the problem is probably in the code for the window, I found that the following XML solves the problem. I guess the crash comes because the rating dialog doesn't have the "next" and "previous" buttons, that are referenced on the "onup" and "ondown" attributes in the XML. Using "ondown" or "onup" calling invisble controls shouldn't crash it though.

    The problem will not be visible in MyMusic, only in dialogs not using the "next" and "previous" buttons.

    Code:
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <window>
    	<id>2013</id>
    	<defaultcontrol>10</defaultcontrol>
    	<allowoverlay>yes</allowoverlay>
    	<controls>
       
    		<control>
    			<type>image</type>
    			<id>0</id>
    			<width>1920</width>
    			<height>1080</height>
    			<texture>semi_trans_back_general_menu.png</texture>
    			<animation effect="fade" time="400">windowopen</animation>
    			<animation effect="fade" time="400">windowclose</animation>
    		</control>
       
    	<control>
    		<description>group element</description>
    	  <type>group</type>
    			<animation effect="fade" time="250">WindowOpen</animation>
    			<animation effect="fade" time="0">WindowClose</animation>
    			<animation effect="slide" start="0,200" end="0,0" tween="quadratic" easing="in" time="150" delay="0">WindowOpen</animation>
       
    	  <control>
    		  <id>0</id>
    		<type>image</type>
    		<posX>441</posX>
    		<posY>296</posY>
    		<width>1040</width>
    		<height>679</height>
    		<texture>context_background.png</texture>
    	  </control>
    	 
    			<control>
    		  <id>2</id>
    		<description>Heading text label</description>
    		<type>label</type>
    		<posX>560</posX>
    		<posY>386</posY>
    				<width>820</width>
    		<font>font22</font>
    		<textcolor>ff393939</textcolor>
    		<label>181</label>
    	  </control>
     
    		<control>
    			<id>3</id>
    			<description>Rating label</description>
    			<type>label</type>
    			<posX>533</posX>
    			<posY>700</posY>
    			<width>300</width>
    			<align>center</align>
    			<label>204</label>
    		</control>
    	   
    	  <control>
    		<id>11</id>
    		<description>left button</description>
    		<type>button</type>
    		<onleft>11</onleft>
    		<onright>10</onright>
    		<onup>15</onup>
    		<ondown>15</ondown>
    		<posX>560</posX>
    		<posY>622</posY>
    		<width>36</width>
    		<height>37</height>
    		<textureFocus>arrow_round_left_focus.png</textureFocus>
    		<textureNoFocus>arrow_round_left_nofocus.png</textureNoFocus>
    	  </control>
    	   
    	  <control>
    		<id>10</id>
    		<description>right button</description>
    		<type>button</type>
    		<onleft>11</onleft>
    		<onright>10</onright>
    		<onup>13</onup>
    		<ondown>13</ondown>
    		<posX>1308</posX>
    		<posY>622</posY>
    		<width>36</width>
    		<height>37</height>
    		<textureFocus>arrow_round_right_focus.png</textureFocus>
    		<textureNoFocus>arrow_round_right_nofocus.png</textureNoFocus>
    	  </control>
    	   
    	  <control>
    		<id>15</id>
    		<description>previous item</description>
    		<type>button</type>
    		<onleft>15</onleft>
    		<onright>13</onright>
    		<onup>11</onup>
    		<ondown>14</ondown>
    		<posX>560</posX>
    		<posY>692</posY>
    		<width>36</width>
    		<height>37</height>
    		<textureFocus>arrow_round_left_focus.png</textureFocus>
    		<textureNoFocus>arrow_round_left_nofocus.png</textureNoFocus>
    	  </control>
    	   
    		<control>
    		<id>13</id>
    		<description>next item</description>
    		<type>button</type>
    		<onleft>12</onleft>
    		<onright>13</onright>
    		<onup>10</onup>
    		<ondown>12</ondown>
    		<posX>1308</posX>
    		<posY>692</posY>
    		<width>36</width>
    		<height>37</height>
    		<textureFocus>arrow_round_right_focus.png</textureFocus>
    		<textureNoFocus>arrow_round_right_nofocus.png</textureNoFocus>
    	  </control>
    	   
    	  <control>
    		<id>14</id>
    		<description>Play</description>
    		<type>button</type>
    				<posX>682</posX>
    				<posY>802</posY>
    				<textYOff>0</textYOff>
    				<width>261</width>
    				<height>58</height>
    				<textalign>center</textalign>
    				<textcolor>FF000000</textcolor>
    				<textcolorNoFocus>FF393939</textcolorNoFocus>
    				<textureFocus>button_music_info_focus.png</textureFocus>
    				<textureNoFocus>button_music_info_nofocus.png</textureNoFocus>
    		<label>208</label>
    		<onleft>12</onleft>
    		<onright>12</onright>
    		<onup>15</onup>
    		<ondown>11</ondown>
    	  </control>
    	   
    	  <control>
    		<id>12</id>
    		<description>OK button</description>
    		<type>button</type>
    				<posX>962</posX>
    				<posY>802</posY>
    				<textYOff>0</textYOff>
    				<width>261</width>
    				<height>58</height>
    				<textalign>center</textalign>
    				<textcolor>FF000000</textcolor>
    				<textcolorNoFocus>FF393939</textcolorNoFocus>
    				<textureFocus>button_music_info_focus.png</textureFocus>
    				<textureNoFocus>button_music_info_nofocus.png</textureNoFocus>
    		<label>186</label>
    		<onleft>14</onleft>
    		<onright>14</onright>
    		<onup>13</onup>
    		<ondown>10</ondown>
    	  </control>
     
    	  <control>
    		<id>4</id>
    		<description>Title</description>
    		<type>label</type>
    		<posX>605</posX>
    		<posY>711</posY>
    				<width>685</width>
    				<align>center</align>
    		<label>204</label>
    		<textcolor>ff393939</textcolor>
    	  </control>
    	   
    			<control>
    		<id>0</id>
    		<type>image</type>
    		<posX>818</posX>
    		<posY>616</posY>
    		<width>53</width>
    		<height>41</height>
    		<texture>starblack_rating.png</texture>
    	  </control>
    	   
    	  <control>
    		<id>0</id>
    		<type>image</type>
    		  <posX>876</posX>
    		<posY>616</posY>
    		<width>53</width>
    		<height>41</height>
    		<texture>starblack_rating.png</texture>
    	  </control>
    	   
    	  <control>
    		<id>0</id>
    		<type>image</type>
    		<posX>930</posX>
    		<posY>616</posY>
    		<width>53</width>
    		<height>41</height>
    		<texture>starblack_rating.png</texture>
    	  </control>
    	   
    	  <control>
    		<id>0</id>
    		<type>image</type>
    		<posX>984</posX>
    		<posY>616</posY>
    		<width>53</width>
    		<height>41</height>
    		<texture>starblack_rating.png</texture>
    	  </control>
    	   
    	  <control>
    		<id>0</id>
    		<type>image</type>
    		<posX>1038</posX>
    		<posY>616</posY>
    		<width>53</width>
    		<height>41</height>
    		<texture>starblack_rating.png</texture>
    	  </control>
    	   
    	  <control>
    		<id>100</id>
    		<type>image</type>
    		<posX>818</posX>
    		<posY>616</posY>
    		<width>53</width>
    		<height>41</height>
    		<texture>starblue_rating.png</texture>
    	  </control>
    	   
    	  <control>
    		<id>101</id>
    		<type>image</type>
    		<posX>876</posX>
    		<posY>616</posY>
    		<width>53</width>
    		<height>41</height>
    		<texture>starblue_rating.png</texture>
    	  </control>
    	   
    	  <control>
    		<id>102</id>
    		<type>image</type>
    		<posX>930</posX>
    		<posY>616</posY>
    		<width>53</width>
    		<height>41</height>
    		<texture>starblue_rating.png</texture>
    	  </control>
    	   
    	  <control>
    		<id>103</id>
    		<type>image</type>
    		<posX>984</posX>
    		<posY>616</posY>
    		<width>53</width>
    		<height>41</height>
    		<texture>starblue_rating.png</texture>
    	  </control>
    	   
    	  <control>
    		<id>104</id>
    		<type>image</type>
    		<posX>1038</posX>
    		<posY>616</posY>
    		<width>53</width>
    		<height>41</height>
    		<texture>starblue_rating.png</texture>
    	  </control>	   
    		</control>
    	   
      </controls>
    </window>

    This is the C# part that calls GUIDIalogSetRating:

    Code:
    	private void rateMovie(int itemId)
    	{
    	  Log.Info("HeadWeb: rateMovie()");
    	  try
    	  {
     
    		XmlDocument doc_get = new XmlDocument();
    		string requestUrl_get = Utils.constructUrl("content/" + movieId.ToString() + "/rate", "");
    		string rootXML_get = Utils.GetWebData(requestUrl_get, HeadWebSettings.Instance.s_cc, null, null, false, false, null, "GET", null, false, false);
    		doc_get.LoadXml(rootXML_get);
    		XmlNode rating_get = doc_get.SelectSingleNode("//response/rating");
    		double drating = double.Parse(rating_get.InnerText, NumberFormatInfo.InvariantInfo);
    		int rating = Convert.ToInt32(drating);
     
    		GUIDialogSetRating dlg = (GUIDialogSetRating)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_RATING);
    		if (dlg != null && !string.IsNullOrEmpty(s_name))
    		{
    		  dlg.SetTitle(String.Format("{0}-{1}", s_name, s_year));
    		  dlg.Rating = rating;
    		  GUIControl.HideControl(dlg.GetID, 13);
    		  GUIControl.HideControl(dlg.GetID, 14);
    		  GUIControl.HideControl(dlg.GetID, 15);
    		}
    		dlg.DoModal(GetID);
     
    		XmlDocument doc_set = new XmlDocument();
    		string requestUrl_set = Utils.constructUrl("content/" + movieId.ToString() + "/rate", "");
    		string postRequestParams = "score=" + dlg.Rating;
    		string rootXML_set = Utils.GetWebData(requestUrl_set, HeadWebSettings.Instance.s_cc, null, null, false, false, null, "POST", postRequestParams, false, false);
    		doc_set.LoadXml(rootXML_set);
    		XmlElement root_set = doc_set.DocumentElement;
    	  }
    	  catch (Exception e)
    	  {
    		Log.Error("HeadWeb: rateMovie() caused an exception " + e.Message);
    	  }
    	}
    [DOUBLEPOST=1369082646][/DOUBLEPOST]Hmmm, just realized that my code hides three controls, which is probably not nice. But should it crash MP?:

    Code:
    		  GUIControl.HideControl(dlg.GetID, 13);
    		  GUIControl.HideControl(dlg.GetID, 14);
    		  GUIControl.HideControl(dlg.GetID, 15)
     

    Users who are viewing this thread

    Top Bottom