Opened 14 years ago

Closed 14 years ago

#4128 closed patch (fixed)

segfault in mythtv-setup after DiSEqCDevTree check

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


Setup: pcHDTV 5500 WinTV PVR500 Ubuntu Gutsy

Error msgs: mythtv-setup:

DiSEqCDevTree, Warning: No device tree for cardid (then Seg fault) -- looks like maybe a Qt bug?

while recording:

TVRec(1): Changing from None to RecordingOnly? TVRec(1): HW Tuner: 1->1 Channel(/dev/video1) Error: SetInputAndFormat?(1, ATSC)

while setting format (v4l v2) eno: Invalid argument (22)

Channel(/dev/video1) Error: SetInputAndFormat?(1, ATSC)

while setting format (v4l v2) eno: Invalid argument (22)

Channel(/dev/video1): SetInputAndFormat?() failed TVRec(1) Error: Failed to set channel to 6. Reverting to


TVRec(1): Changing from RecordingOnly? to None Canceled recording (Recorder Failed): Whacked Out Sports

: channel 1006 on cardid 1, sourceid 1

Watching Live TV works for both PVR500 and pcHDTV 5500. Can change channels, switch inputs, everything as normal. Recordings fail on PVR500 but work on pcHDTV 5500

Have tried: both stock Gutsy and custom kernel to eliminate module issues dropped entire DB and rebuilt from mc.sql (mythtv-setup segfaults after eatch input setup)

Attachments (2)

gdb.txt (6.7 KB) - added by mythtv@… 14 years ago.
GDB file for mythtv-setup
4128-v1.patch (14.1 KB) - added by danielk 14 years ago.
Fix for segfault

Download all attachments as: .zip

Change History (9)

Changed 14 years ago by mythtv@…

Attachment: gdb.txt added

GDB file for mythtv-setup

comment:1 Changed 14 years ago by danielk

Summary: recordings fail for PVR500 but pcHDTV 5500 recordings worksegfault in mythtv-setup after DiSEqCDevTree check

Can you give me a better description of the DiSEqCDevTree segfault?

What were you doing when this happened?

Is it reproducible by following a series of steps?

And are you using svn 0.20-fixes or svn trunk?

The other problem you're experiencing is just a configuration error, "ATSC" is not a valid format for any analog recording. You need to change either the default format or the input specific one. (Please use the mythtv users mailing list if you need further help with this problem.)

comment:2 Changed 14 years ago by mythtv@…

The DiSEqCDev Tree segfault happens after:

1) starting mythtv-setup 2) choosing Capture Cards 3) editing an existing card, deleting all cards, or deleting all cards on the master backend

if i select finish on the card setup screen I get the segfault. It happens every time I go into those screens or into the input connections screens.

comment:3 Changed 14 years ago by danielk

Owner: changed from Isaac Richards to danielk
Status: newassigned

comment:4 Changed 14 years ago by Janne Grunau

That looks like it's the same issue I've see after the ListBoxSetting::clearSelections addition in [14791].

Changed 14 years ago by danielk

Attachment: 4128-v1.patch added

Fix for segfault

comment:5 Changed 14 years ago by danielk

I've attached a patch which fixes the segfault. It needs a bit of testing, and has debugging statements in it for that purpose...

comment:6 Changed 14 years ago by danielk

Milestone: unknown0.21
Type: defectpatch

comment:7 Changed 14 years ago by danielk

Resolution: fixed
Status: assignedclosed

(In [14813]) Fixes #4128. Refs #4096. This fixes segfault on use of invalid widget pointer in "Capture cards", "Video sources" and "Input connections" screen.

* This changeset requires a "make distclean" due to ABI changes in settings.h *

These segfaults were a regression caused by [14791] which fixed #4096.

The problem in #4096 was that the "destroyed(void)" signal of the QWidget returned by ListBoxSetting::configWidget() was being used to set a different QWidget pointer to NULL. Unfortunately, the QWidget we were getting the "destroyed()" signal for was not the last QWidget ListBoxSetting::configWidget() had returned. This caused us to enter an inconsistent state.

This problem is also present in other Configurables which use a pointer to a QWidget to update the UI after the configWidget() call.

The solution is to invalidate the QWidget pointers before configWidget() is called again on a Configurable. To do this I added a virtual widgetInvalid(QObject*) method to Configurable. The one in configurable one does nothing, because most Configurables do not use a QWidget pointers. But those that do can use this to clear the pointers. This is called by all classes that call configWidget() before the widget is either deleted or configWidget() is called again on the same Configurable, basically it is called when the widget is removed from it's layout. This ensures the Configrables that rely on a QWidget pointer can be sure it is set NULLed before the widget is deleted but before configWidget() is called again.

But I also wanted to make sure that if widgetInvalid(QObject*) is called after configWidget() is called again on a Configurable, this will not cause any problems. So widgetInvalid's param is the pointer it returned from configWidget(). If this doesn't match the last pointer returned from configWidget() the Configrable must ignore the widgedInvalid() call.

Since we give the widget pointer to the Configurable in widgetInvalid() we can also call it on the destroyed(QObject*) signal. This shouldn't be needed, but if any class forgets a widgetInvalid() call on a widget they instanciated, this will prevent the Configurable from having a pointer to a deleted QWidget. Unlike the primary fix of calling widgetInvalid() at the appropriate times, this doesn't prevent a Configurable from updating the wrong QWidget if a Configurable is being updated from outside the Qt event thread, but it does prevent this error from causing a segfault.

Note: See TracTickets for help on using tickets.