Opened 13 years ago

Closed 13 years ago

#1951 closed patch (fixed)

mythfrontend segfaults when sending 'key x' through the telnet interface, when in the Main Menu only.

Reported by: navahogunleg@… Owned by: cpinkham
Priority: minor Milestone: unknown
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Today I first used the network control interface and I noticed that, when in the Main Menu, and you try to send a key press through the telnet interface (for instance 'key Down'), this causes a segmentation fault.

Tracking it down to NetworkControl::processKey(), in networkcontrol.cpp, at line ~332, where gContext->GetMainWindow?()->currentWidget() returns a NULL pointer, I found that, oddly enough, this only occurs when in the Main Menu.

Supplied is a patch that checks all the pointers before accessing them, and will return a human-readable error if anything is wrong with them. Regardless of whether something is not getting set when in the Main Menu, this at least prevents it taking down the front-end.

Attachments (1)

mythtv-networkcontrol-fix-20060613 (833 bytes) - added by navahogunleg@… 13 years ago.

Download all attachments as: .zip

Change History (5)

Changed 13 years ago by navahogunleg@…

comment:1 Changed 13 years ago by anonymous

Owner: changed from Isaac Richards to cpinkham

comment:2 Changed 13 years ago by martin@…

Nice! I was meaning to comment on this issue but never got around to it. I have seen the occasional segfault in submenus, though. I have never been able to use a 'key' event in the Main Menu, just like you. Luckily I have a remote with many buttons so I could make a 'jump xxx' statement for most stuff (tv, music, photos...) - It'll be really cool to have this fixed :)

comment:3 Changed 13 years ago by martin@…

I have now tried this patch with SVN 10224 and although it doesn't crash the frontend, it doesn't seem to work as expected either. Any keypress event in the menus are now ignored, at least for me:

Very short example below.

Starting of in the Main Menu:

Martin64:/vol/ScratchPad # telnet localhost 6546 Trying 127.0.0.1... Connected to localhost. Escape character is ']'. MythFrontend Network Control Type 'help' for usage information


# key down ERROR: Application has no current widget. # key down ERROR: Application has no current widget. # jump playbackbox OK # key down OK # quit

Reading the above again, I suppose it never said it made the keys work in the menu.. :)

comment:4 Changed 13 years ago by cpinkham

Resolution: fixed
Status: newclosed

(In [10506]) Fix the "key" command in Network Control mode when on the main menu. Not sure how long this has been broken, but it works again. If you experience issues trying to send key commands from another window when running mythfrontend under X, this may be expected. The keys are normally sent to the widget that has focus, so if your mythfrontend doesn't have focus, then it will not respond to 'key' commands on some dialogs.

Fixes #1951 and references [8740] since that is when I first added this part of the code.

Note: See TracTickets for help on using tickets.