[mythtv-commits] Ticket #4096: Incorrect handling of the (All) datasource in mythtv-setup

MythTV mythtv at cvs.mythtv.org
Wed Nov 7 17:53:00 UTC 2007


#4096: Incorrect handling of the (All) datasource in mythtv-setup
-------------------------+--------------------------------------------------
 Reporter:  stuarta      |        Owner:  danielk
     Type:  defect       |       Status:  closed 
 Priority:  minor        |    Milestone:  0.21   
Component:  channelscan  |      Version:  head   
 Severity:  medium       |   Resolution:  fixed  
  Mlocked:  0            |  
-------------------------+--------------------------------------------------

Comment(by danielk):

 (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.

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/4096#comment:7>
MythTV <http://svn.mythtv.org/trac>
MythTV


More information about the mythtv-commits mailing list