Kodi Community Forum

Full Version: WindowXMLDialog on exit causing Kodi crash
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
so I have a plugin and I want to introduce a window dialog to it. this is my class inheriting from WindowXMLDialog:

Code:
class MyCvv(xbmcgui.WindowXMLDialog):
    def show(self):
        self.doModal()
    
    def __log(self, text):
        import datetime
        print datetime.datetime.now(), 'LOGGER: %s' % text

    def __init__(self, *args, **kwargs):
        xbmc.executebuiltin('Skin.Reset(AnimeWindowXMLDialogClose)')
        xbmc.executebuiltin('Skin.SetBool(AnimeWindowXMLDialogClose)')
        self.name = ''
        self.sec_cvv = ''
        self.__log('CVV Initialized')
    
    def onClick(self, controlID):
        if controlID == 7:
            self.name = self.getControl(8).getText().replace(' ','%20')
            self.sec_cvv = self.getControl(22).getText()

            self.__log('CC Data => Name: %s' %self.name)
            dialog = xbmcgui.Dialog()
            dialog.ok('CVV', '','Complete.', '')

            xbmc.executebuiltin('Skin.Reset(AnimeWindowXMLDialogClose)')
            self.close()

and my code that calls the class:
Code:
cvv = MyCvv('cvv.xml',__settings__.getAddonInfo('path'),'Default')
cvv.show()
del cvv

dialog = xbmcgui.Dialog()
dialog.ok('CVV', '','Next?.', '')

I get the
Code:
Complete
log in my log file, but after the close my Kodi crashes without any log traces.
I don't even get to the next dialog.

An help please would be greatly appreciated.
some debug logs here
Code:
11:04:43 T:140735180362496   DEBUG: ------ Window Init (/Users/######/Library/Application Support/Kodi/addons/plugin.video.########/resources/skins/Default/720p/########.xml) ------
11:04:43 T:140735180362496    INFO: Loading skin file: /Users/######/Library/Application Support/Kodi/addons/plugin.video.######/resources/skins/Default/720p/######.xml, load type: LOAD_ON_GUI_INIT
11:04:43 T:140735180362496   DEBUG: CGUIMediaWindow::GetDirectory ()
11:04:43 T:140735180362496   DEBUG:   ParentPath = []
11:04:44 T:140735180362496   DEBUG: Keyboard: scancode: 0x00, sym: 0x0136, unicode: 0x0000, modifier: 0x0
11:04:44 T:140735180362496   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200
11:04:44 T:140735180362496   DEBUG: Previous line repeats 3 times.
11:04:44 T:140735180362496   DEBUG: OnKey: 0 (0xf200) pressed, trying keyboard action f000
11:04:44 T:140735180362496   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200
11:04:44 T:140735180362496   DEBUG: OnKey: 0 (0xf200) pressed, action is
11:04:46 T:140735180362496   DEBUG: Keyboard: scancode: 0x00, sym: 0x0136, unicode: 0x0000, modifier: 0x0
11:04:46 T:140735180362496   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200
11:04:46 T:140735180362496   DEBUG: Previous line repeats 3 times.
11:04:46 T:140735180362496   DEBUG: OnKey: 0 (0xf200) pressed, trying keyboard action f000
11:04:46 T:140735180362496   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200
11:04:46 T:140735180362496   DEBUG: OnKey: 0 (0xf200) pressed, action is
11:04:58 T:140735180362496   DEBUG: Keyboard: scancode: 0x08, sym: 0x0063, unicode: 0x0063, modifier: 0x0
11:04:58 T:140735180362496   DEBUG: OnKey: c (0xf043) pressed, trying keyboard action f163
11:04:58 T:140735180362496   DEBUG: Keyboard: scancode: 0x02, sym: 0x0064, unicode: 0x0064, modifier: 0x0
11:04:58 T:140735180362496   DEBUG: OnKey: d (0xf044) pressed, trying keyboard action f164
11:04:58 T:140735180362496   DEBUG: Keyboard: scancode: 0x09, sym: 0x0076, unicode: 0x0076, modifier: 0x0
11:04:58 T:140735180362496   DEBUG: OnKey: v (0xf056) pressed, trying keyboard action f176
11:04:58 T:140735180362496   DEBUG: Keyboard: scancode: 0x01, sym: 0x0073, unicode: 0x0073, modifier: 0x0
11:04:58 T:140735180362496   DEBUG: OnKey: s (0xf053) pressed, trying keyboard action f173
11:04:58 T:140735180362496   DEBUG: Keyboard: scancode: 0x02, sym: 0x0064, unicode: 0x0064, modifier: 0x0
11:04:58 T:140735180362496   DEBUG: OnKey: d (0xf044) pressed, trying keyboard action f164
11:04:59 T:140735180362496   DEBUG: Keyboard: scancode: 0x7d, sym: 0x0112, unicode: 0xf701, modifier: 0x0
11:05:03 T:140735180362496   DEBUG: OnKey: return (0xf00d) pressed, action is Select
11:05:03 T:4720750592  NOTICE: 2015-08-02 11:05:03.483675
11:05:03 T:4720750592  NOTICE: LOGGER: CC Data => Name: cdvsd
11:05:03 T:140735180362496   DEBUG: ------ Window Init (DialogOK.xml) ------
11:05:03 T:140735180362496   DEBUG: Keyboard: scancode: 0x00, sym: 0x0136, unicode: 0x0000, modifier: 0x0
11:05:03 T:140735180362496   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200
11:05:03 T:140735180362496   DEBUG: Previous line repeats 1 times.
11:05:03 T:140735180362496   DEBUG: OnKey: 0 (0xf200) pressed, action is
11:05:08 T:140735180362496   DEBUG: Keyboard: scancode: 0x24, sym: 0x000d, unicode: 0x000d, modifier: 0x0
11:05:08 T:140735180362496   DEBUG: OnKey: return (0xf00d) pressed, action is Select
11:05:09 T:140735180362496   DEBUG: Keyboard: scancode: 0x00, sym: 0x0136, unicode: 0x0000, modifier: 0x0
11:05:09 T:140735180362496   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200
11:05:09 T:140735180362496   DEBUG: Previous line repeats 1 times.
11:05:09 T:140735180362496   DEBUG: OnKey: 0 (0xf200) pressed, action is
11:05:09 T:140735180362496   DEBUG: ------ Window Deinit (DialogOK.xml) ------
11:05:09 T:140735180362496   DEBUG: ------ Window Deinit (/Users/########/Library/Application Support/Kodi/addons/plugin.video.########/resources/skins/Default/720p/##########.xml) ------

Kodi crashes after the last line in the debug log.
Here's my OS X crash report on pastebin

http://pastebin.com/iNKdDgaA
can you reproduce using Kodi 15.0?
Sure I'll give it a shot. On a side note I added this function to my class:

Code:
def onAction(self, action):
        buttonCode =  action.getButtonCode()
        actionID   =  action.getId()
        if (buttonCode == KEY_BUTTON_BACK or buttonCode == KEY_KEYBOARD_ESC):
            self.close()

hitting the esc key will close the window without errors.

I also moved the close call to the beginning of the onclick function. the logs after the close appear in the kodi log file and it still crashes.
Code:
def onClick(self, controlID):
        if controlID == 7:
            xbmc.executebuiltin('Skin.Reset(AnimeWindowXMLDialogClose)')
            self.close()

            self.name = self.getControl(8).getText().replace(' ','%20')
            self.sec_cvv = self.getControl(22).getText()

            self.__log('CC Data => Name: %s' %self.name)
            dialog = xbmcgui.Dialog()
            dialog.ok('CVV', '','Complete.', '')
            return
Works fine in Kodi 15.0.
Smile great.
Sorry but we won't fix anything for 14.x any more
But this is a major bug in 14 which is most likely still the majority of systems out there. There is a fundamental issue with the destruction of the Window class which is causing the system crash. Surely a hotfix or maintenance release to fix this issue is possible?
Nope
There might be plenty other but we ding do 14 releases anymore
In that case is there a builtin method to check the version of kodi? I can then only show the window to isengard users and use a bunch of dialogs to collect my data with helix or lower...
Here's a quick hack example

Code:
XBMC_VERSION = "Frodo"
log(xbmcaddon.Addon('xbmc.addon').getAddonInfo('version')[0:4])
version_number = float(xbmcaddon.Addon('xbmc.addon').getAddonInfo('version')[0:4])
if version_number >= 12.9:
    XBMC_VERSION = "Gotham"
if version_number >= 13.9:
    XBMC_VERSION = "Helix"
if version_number >= 14.9:
    XBMC_VERSION = "Isengard"
log("Kodi Version is " + XBMC_VERSION)