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





-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to