[Qt-interest] QStackedWidget crash, but only when running in debugger

Ian Thomson Ian.Thomson at iongeo.com
Wed Nov 4 15:10:50 CET 2009


Hi Andre,

This shouldn't happen. However, you haven't provided enough information 
for anyone to know why it happens. A small compilable example is always 
best.

Just because it crashes in the debugger doesn't mean the debugger is the 
problem. Not all bad things cause crashes all the time, your 
non-debugged program could still be referencing invalid memory but due 
to the way the program is run, it gets lucky and doesn't crash.

Random guess: Did you forget to call setupUi on your designer created form?

Cheers,
Ian Thomson

Andre Somers wrote:
> Nobody?
> 
> Andre Somers wrote:
>> Hi,
>>
>> I am running into an annoying problem using the debugger from Qt Creator 
>> (from 2009.3 SDK for Windows XP). I am trying to debug a crash in my 
>> application. The problem is, the application crashes at startup in the 
>> debugger, while in the normal situation it runs perfectly fine using 
>> exactly the same build (debug). The crash occurs at a moment a widget is 
>> added to a QStackedWidget using addWidget(configuration).
>>
>> QWidget* configuration = ext->configurationWidget(0);
>>
>> if (configuration) {
>>
>> ui.propertyStack->addWidget(configuration);
>>
>> connect(ext, SIGNAL(closeConfiguration()), this, 
>> SLOT(closePropertyConfiguration()));
>>
>> }
>>
>>
>> The call is made at the third line of the code above. At the moment of 
>> calling, both the QStackedWidget ui.propertyStack and the configuration 
>> widget I am trying to add are perfectly valid pointers.
>>
>> This is the stacktrace I get. The call is made from the function at 
>> level 6.
>>
>> 0    QObject::parent    qobject.h    243   
>> 1    QWidget::parentWidget    qwidget.h    988   
>> 2    QLayout::addChildWidget    qlayout.cpp    948   
>> 3    QStackedLayout::insertWidget    qstackedlayout.cpp    213   
>> 4    QStackedLayout::addWidget    qstackedlayout.cpp    193   
>> 5    QStackedWidget::addWidget    qstackedwidget.cpp    166   
>> 6    MatrixSetup::addPropertyExtension    matrixsetup.cpp    651   
>> 7    MatrixSetup::initializePropertyExtensionTree    matrixsetup.cpp    
>> 637   
>> 8    MatrixSetup::MatrixSetup    matrixsetup.cpp    105   
>> 9    Ui_MainUi::setupUi    ui_main.h    140   
>> 10    MainUiMatrixCompiler::MainUiMatrixCompiler    mainui.cpp    15   
>> 11    qMain    main.cpp    16   
>> 12    WinMain    qtmain_win.cpp    136   
>> 13    main        0   
>>
>> Can anyone please point me to an explanation on what's going on here, 
>> and to get around it? It is very annoying that the debugger seems to 
>> trigger bugs all by itself... That makes debugging *actual* problems 
>> quite a bit harder and more time consuming than nessecairy.
>>
>> Thanks,
>>
>> André



More information about the Qt-interest-old mailing list