Dialog().select gives segmentation fault

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
el_Paraguayo Offline
Donor
Posts: 630
Joined: Feb 2011
Reputation: 14
Location: London, UK
Post: #1
This is really weird.

Yes/No dialogs work fine. OK dialogs work fine. DialogProcess runs fine.

However, if I try to use a Dialog().select xbmc crashes every time with a segmentation fault.

Is there something obviously wrong with my code?

Code:
def ShowUserDialog():
    if actiontype == 0:
        powerMode = "Suspend"
    elif actiontype == 1:
        powerMode = "Hibernate"
    print powerMode
    myArgs = [str(powerMode),'Lock', 'Unlock', 'Cancel']
    print myArgs
    userChoice = xbmcgui.Dialog().select("Myth Suspend Alarm", myArgs)
    print userChoice

xbmc.log shows the output of "print myArgs" - so I know it's crashing on the dialog step.

Even if I replace myArgs with, say ["1", "2"] I get the same error.

This is the crashlog: http://pastebin.com/uCWZVhAK

This is the last piece of my script - gutted that this is causing a problem as it seems so straightforward.

Any help would be greatly appreciated.

MythSuspendAlarm: Suspend and wake for next MythTV recording.
BBC Live Football Scores: Football scores notifications.
Random Movie Script: Play random movies from library.
find quote
jfcarroll Offline
Team-XBMC Developer
Posts: 455
Joined: Dec 2006
Reputation: 3
Location: Philadelphia area, US
Post: #2
Trunk build, or Dharma?
find quote
giftie Offline
Skilled Python Coder
Posts: 2,364
Joined: Mar 2010
Reputation: 54
Location: Calgary, Alberta
Post: #3
I just tested this code and it works fine on my two systems(10.1 and pre-11 that was build on the 24th of april) No errors, complete and proper working. I copied and paste the code(corrected for the tabs -> made the into spaces) and it worked flawlessly.

Also, if your actiontype is always going to be an integer, you can use the following code to reduce some lines:

Code:
powerMode = ['Suspend', 'Hibernate', ]
    myArgs = [ powerMode[actiontype], 'Lock', 'Unlock', 'Cancel' ]

Since XBMC is crashing, have you tried to use the traceback module in Python.

for example using your code:

Code:
def ShowUserDialog():
    import traceback
    try:
        if actiontype == 0:
            powerMode = "Suspend"
        elif actiontype == 1:
            powerMode = "Hibernate"
        print powerMode
        myArgs = [str(powerMode),'Lock', 'Unlock', 'Cancel']
        print myArgs
        userChoice = xbmcgui.Dialog().select("Myth Suspend Alarm", myArgs)
        print userChoice
    except:
        print "Error Occured"
        traceback.print_exc()

If the scripting is causing the error, this should show what error happens(and also not crash)


el_Paraguayo Wrote:This is really weird.

Yes/No dialogs work fine. OK dialogs work fine. DialogProcess runs fine.

However, if I try to use a Dialog().select xbmc crashes every time with a segmentation fault.

Is there something obviously wrong with my code?

Code:
def ShowUserDialog():
    if actiontype == 0:
        powerMode = "Suspend"
    elif actiontype == 1:
        powerMode = "Hibernate"
    print powerMode
    myArgs = [str(powerMode),'Lock', 'Unlock', 'Cancel']
    print myArgs
    userChoice = xbmcgui.Dialog().select("Myth Suspend Alarm", myArgs)
    print userChoice

xbmc.log shows the output of "print myArgs" - so I know it's crashing on the dialog step.

Even if I replace myArgs with, say ["1", "2"] I get the same error.

This is the crashlog: http://pastebin.com/uCWZVhAK

This is the last piece of my script - gutted that this is causing a problem as it seems so straightforward.

Any help would be greatly appreciated.

[Image: e4f63e45ba34fe4695b3bb08eb2499d8e4ee484e...4c076g.jpg]
For troubleshooting and bug reporting please make sure you read this first you can also use XBMC Log Uploader Script.
Cinema Experience
Cinema Experience Wiki
cdART Manager
fanart.tv


find quote
el_Paraguayo Offline
Donor
Posts: 630
Joined: Feb 2011
Reputation: 14
Location: London, UK
Post: #4
jfcarroll: Apologies for the lack of info (I'm guilty of something I always get frustrated with other people doing when asking for help!).

I'm running Dharma on Mythbuntu 10.10 with the Aeon Mq 2 skin and (seeing as the crashlog refers to nvidia) I'm using nvidia drivers 260.19.29 on a GT210 card.

Giftie, I'm glad the code works for you (it would have been embarrassing if the error was down to my newbie python coding skills!) however that does seem to leave me with fewer options.

I'll try the traceback tip when I'm home from work and will report back after then.

Thanks.

el_P

MythSuspendAlarm: Suspend and wake for next MythTV recording.
BBC Live Football Scores: Football scores notifications.
Random Movie Script: Play random movies from library.
find quote
el_Paraguayo Offline
Donor
Posts: 630
Joined: Feb 2011
Reputation: 14
Location: London, UK
Post: #5
Sadly the traceback plan didn't work.

XBMC crashes as before, no additional info printed to xbmc.log.

UPDATE: Not sure if this means anything or not but, I changed the code to this:
Code:
def ShowUserDialog():
  try:
    if actiontype == 0:
      powerMode = "Suspend"
    elif actiontype == 1:
      powerMode = "Hibernate"
    print powerMode
    myArgs = []
    myArgs = [ 'Unlock', 'Cancel' ]
    print myArgs
    userChoice = xbmcgui.Dialog()
    userChoice.yesno("Myth Suspend Alarm", "test")
    print userChoice
  except:
    print "Error Occured"
    traceback.print_exc()

the dialog showed ok, but I had the following in xbmc.log:

Code:
19:36:43 T:2769283952 M:3747811328  NOTICE: Suspend
19:36:43 T:2769283952 M:3747811328  NOTICE: ['Unlock', 'Cancel']
[b]19:36:43 T:2769283952 M:3747852288 WARNING: Skin has invalid include: DialogInfo[/b]19:37:00 T:2769283952 M:3747385344 WARNING: Previous line repeats 5 times.
19:37:00 T:2769283952 M:3747385344  NOTICE: <xbmcgui.Dialog object at 0xa1a77580>
19:37:00 T:2769283952 M:3747385344  NOTICE: MythSuspendAlarm: Beginning powerdown...

So I'm wondering if it's the skin...

MythSuspendAlarm: Suspend and wake for next MythTV recording.
BBC Live Football Scores: Football scores notifications.
Random Movie Script: Play random movies from library.
(This post was last modified: 2011-04-26 20:40 by el_Paraguayo.)
find quote
el_Paraguayo Offline
Donor
Posts: 630
Joined: Feb 2011
Reputation: 14
Location: London, UK
Post: #6
Yup - looks like the skin is guilty.

Switched to Confluence skin and it worked.

I'll post in that forum.

Thanks for your help.

MythSuspendAlarm: Suspend and wake for next MythTV recording.
BBC Live Football Scores: Football scores notifications.
Random Movie Script: Play random movies from library.
find quote