List Info

Thread: Re: Bug#475748: psi: Segfault when clicking on Preferences -> Appearance




Re: Bug#475748: psi: Segfault when clicking on Preferences -> Appearance
user name
2008-04-13 10:34:21
On Sat, Apr 12, 2008 at 07:13:41PM +0200, Marek Elias
wrote:
> In prefernces window, when clicking on appearance, PSI
segfaults:
> kernel: [53510.815342] psi[28666]: segfault at 00000000
eip 083803a8 esp bfab5880 error 4
> (from syslog)
> 
> You can find dumped core here: http://mebs
.matfyz.cz/neporiadok/core.psi

I tracked this down to OptionsTabWidget::addTab(OptionsTab
*tab), where
QTabWidget::addTab() is called before initializing wtab[].
It seems like
qt4.4 is triggering the currentChanged signal immediately on
calling
addTab(). As wtab[] has not been initialized at this point,
the
following code in updateCurrent() segfaults:

                OptionsTab *opttab = w2tab[w].tab;

                QWidget *tab = opttab->widget();

The fix is easy: Change OptionsTabWidget::addTab to call
QTabWidget::addTab after
initializing w2tab. (Patch below)

Jan


diff --git a/src/options/optionstab.cpp
b/src/options/optionstab.cpp
index cd935d0..ae5d00d 100644
--- a/src/options/optionstab.cpp
+++ b/src/options/optionstab.cpp
 -142,15
+142,16  void OptionsTabWidget::addTab(OptionsTab *tab)
 	// when inserting it with "addTab"
 	QWidget *w = new QWidget(NULL, tab->name().latin1());
 
+	if ( !tab->desc().isEmpty() )
+		setTabToolTip(w, tab->desc());
+
+	w2tab[w] = TabData(tab);
+
 	if ( tab->tabIcon() )
 		QTabWidget::addTab(w, tab->tabIcon()->icon(),
tab->tabName());
 	else
 		QTabWidget::addTab(w, tab->tabName());
 
-	if ( !tab->desc().isEmpty() )
-		setTabToolTip(w, tab->desc());
-
-	w2tab[w] = TabData(tab);
 	
 	//FIXME: this is safe for our current use of addTab, but
may
 	//be inconvenient in the future (Qt circa 4.2 had a bug
which stopped


_______________________________________________
Psi-Devel mailing list
Psi-Devellists.affinix.com
http://lists.affinix.com/listinfo.cgi/psi-devel-affin
ix.com

Re: Bug#475748: psi: Segfault when clicking on Preferences -> Appearance
user name
2008-04-14 14:55:27
On Sun, Apr 13, 2008 at 05:34:21PM +0200, Jan Niehusmann
wrote:
> On Sat, Apr 12, 2008 at 07:13:41PM +0200, Marek Elias
wrote:
> > In prefernces window, when clicking on appearance,
PSI segfaults:
> > kernel: [53510.815342] psi[28666]: segfault at
00000000 eip 083803a8 esp bfab5880 error 4
> > (from syslog)
> > 
> > You can find dumped core here: http://mebs
.matfyz.cz/neporiadok/core.psi
> 
> I tracked this down to
OptionsTabWidget::addTab(OptionsTab *tab), where
> QTabWidget::addTab() is called before initializing
wtab[]. It seems like
> qt4.4 is triggering the currentChanged signal
immediately on calling
> addTab(). As wtab[] has not been initialized at this
point, the
> following code in updateCurrent() segfaults:
> 
>                 OptionsTab *opttab = w2tab[w].tab;
> 
>                 QWidget *tab = opttab->widget();
> 
> The fix is easy: Change OptionsTabWidget::addTab to
call QTabWidget::addTab after
> initializing w2tab. (Patch below)
> 

Thanks for the problem analysis and the patch. 
Fix is applied.

 - Martin H.
_______________________________________________
Psi-Devel mailing list
Psi-Devellists.affinix.com
http://lists.affinix.com/listinfo.cgi/psi-devel-affin
ix.com

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )