Skip to content
This repository
Browse code

CGUIWindowSettingsCategory: only handle delayed settings during GUI_M…

…SG_FOCUSED if the focused setting is not the delayed setting

When using a mouse to control XBMC changing the value of a spinner with a left
click results in a GUI_MSG_FOCUSED message. If that setting is delayed a left
click lead to the early evaluation of the delayed setting even though it's
still being changed (which should just result in a reset of the delay timer).
This lead to crashes if a setting changed callback executed a skin reload.
  • Loading branch information...
commit 3111408bb70c8706a79333fb18265fd0b74bbb39 1 parent 3c469dc
Sascha Montellese authored May 15, 2013
7  xbmc/settings/windows/GUIWindowSettingsCategory.cpp
@@ -155,15 +155,16 @@ bool CGUIWindowSettingsCategory::OnMessage(CGUIMessage &message)
155 155
       CGUIWindow::OnMessage(message);
156 156
       if (!m_returningFromSkinLoad)
157 157
       {
158  
-        // cancel any delayed changes
159  
-        if (m_delayedSetting != NULL)
  158
+        int focusedControl = GetFocusedControlID();
  159
+
  160
+        // cancel any delayed changes if the focused control has changed
  161
+        if (m_delayedSetting != NULL && m_delayedSetting->GetID() != focusedControl)
160 162
         {
161 163
           m_delayedTimer.Stop();
162 164
           CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), GetID(), 1); // param1 = 1 for "reset the control if it's invalid"
163 165
           OnMessage(message);
164 166
         }
165 167
 
166  
-        int focusedControl = GetFocusedControlID();
167 168
         // check if we have changed the category and need to create new setting controls
168 169
         if (focusedControl >= CONTROL_START_BUTTONS && focusedControl < (int)(CONTROL_START_BUTTONS + m_categories.size()) &&
169 170
             focusedControl - CONTROL_START_BUTTONS != m_iCategory)

0 notes on commit 3111408

Please sign in to comment.
Something went wrong with that request. Please try again.