[mythtv] [patch] comboboxsetting causes segfault

Matt Zimmerman mdz at debian.org
Tue Mar 9 21:31:41 EST 2004


On Wed, Mar 10, 2004 at 03:15:55AM +0100, Kenneth Aafl?y wrote:

> On Wednesday 10 March 2004 03:00, Matt Zimmerman wrote:
> > On Mon, Mar 08, 2004 at 07:07:30PM +0100, Kenneth Aafl?y wrote:
> > > On Monday 08 March 2004 18:49, Kenneth Aafl?y wrote:
> > > > Hi,
> > > >
> > > > here's a patch which fixes a segfault generated by comboboxsetting.
> > >
> > > A revised version that also removes the connection to the widgets
> > > insertItem, as that is handled by addSelection.
> >
> > I intentionally avoided keeping references to any widgets in the setting
> > class; I think this would all work much better if it worked the other way
> > around, and the widget connected to a signal on the setting which would be
> > emitted if something changed.
> 
> So all widgets should be aware of their higher level settings?

No; they don't have to be, with signals and slots.  configWidget() would
connect the appropriate signals and slots, and that would be it.

> I see another point of failure (i belive), and that is that if a
> subclassed comboboxsetting or listboxsetting adds items in it's
> constructor, they will not be sendt to the widget because the widget is
> not around yet.

That's a non-problem; when the widget is instantiated, it is populated with
the current list of selections.  The problem that was solved by storing a
pointer to "the" widget (which is actually just the most recent one if there
is more than one, and will be overwritten if another is instantiated before
the previous one is destroyed) was how to add new selections to an existing
widget if they were added to the setting.

-- 
 - mdz


More information about the mythtv-dev mailing list