Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug - Loading SKIN lead to KODI crash #27552

@Sebastiii

Description

@Sebastiii

Hi, I have opened a forum thread about this issue here :
https://forum.kodi.tv/showthread.php?tid=383221&pid=3246785#pid3246785

Bug report

Describe the bug

When reloading an installed skin, Kodi crash (21.3 to nightly) on Windows, Android ...

Expected Behavior

The skin should load correctly and not lead to an access violation exception.

Actual Behavior

Kodi lost the method pointer when using reloading skin and leads to the crash.

Possible Fix

bool CGUIWindow::OnAction(const CAction &action)
{
if (action.IsMouse() || action.IsGesture())
return EVENT_RESULT_UNHANDLED != OnMouseAction(action);

// Fix the crash but using only one parent
const int focusedID = GetFocusedControlID();

if (focusedID > 0)
{
CGUIControl* control = GetControl(focusedID);
if (!control)
control = GetFirstFocusableControl(focusedID);

if (control)
{
  if (control->OnAction(action))
    return true;
}

}

// Lead the crash because focusedControl is destroy in parallel
// Start comment this part and use above instead
/CGUIControl focusedControl = GetFocusedControl();
if (focusedControl)
{
while (focusedControl && focusedControl != this)
{
if (focusedControl->OnAction(action))
return true;
focusedControl = focusedControl->GetParentControl();
}
}*/
// End comment this part
else
{
// no control has focus?
// set focus to the default control then
CGUIMessage msg(GUI_MSG_SETFOCUS, GetID(), m_defaultControl);
OnMessage(msg);
}

// default implementations
switch(action.GetID())
{
case ACTION_NAV_BACK:
case ACTION_PREVIOUS_MENU:
return OnBack(action.GetID());
case ACTION_SHOW_INFO:
return OnInfo(action.GetID());
case ACTION_MENU:
if (m_menuControlID > 0)
{
CGUIControl *menu = GetControl(m_menuControlID);
if (menu)
{
int focusControlId;
if (!menu->HasFocus())
{
// focus the menu control
focusControlId = m_menuControlID;
// To support a toggle behaviour we store the last focused control id
// to restore (focus) this control if the menu control has the focus
// while you press the menu button again.
m_menuLastFocusedControlID = GetFocusedControlID();
}
else
{
// restore the last focused control or if not exists use the default control
focusControlId = m_menuLastFocusedControlID > 0 ? m_menuLastFocusedControlID : m_defaultControl;
}

      CGUIMessage msg = CGUIMessage(GUI_MSG_SETFOCUS, GetID(), focusControlId);
      return OnMessage(msg);
    }
  }
  break;

}

return false;
}

and

void CGUIWindow::ClearAll()
{
ResetControlStates();
OnWindowUnload();
CGUIControlGroup::ClearAll();
m_windowLoaded = false;
m_dynamicResourceAlloc = true;
m_visibleCondition.reset();
}

To Reproduce

Steps to reproduce the behavior:

So the step to reproduce it on 21.3, 22 nightly, etc., on Windows :
1- Use keyboard
2- Estuary Skin
3- Go to Settings -> Add-ons -> My add-ons > Look and feel -> Skin -> You have to have some skin already installed there.
4- Go to a skin and select -> Use -> Confirm dialog -> Yes or No will lead to the crash but often happens with "Yes"
5- If it doesn't crash right away, do the same and select the same skin or another one, you must be able to select "Use" to set up the skin

Debuglog

The debuglog can be found here:
No debug log, it hard crashes on reloading skin

Screenshots

Here are some links or screenshots to help explain the problem:

https://ibb.co/6fsHDPQ
https://ibb.co/vxQbhfJm

Additional context or screenshots (if appropriate)

Here is some additional context or explanation that might help:

It seems to happen when using the keyboard and remote but not the mouse because some action is left when using the remote/keyboard that leads to onAction to a pointer clear when the loop is running (While ....)

Your Environment

Used Operating system:

  • Android

  • Linux

  • Windows

  • Operating system version/name:

  • Kodi version: 21.3 to NO (nightly)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Triage: Needed(managed by bot!) issue that was just created and needs someone looking at it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions