PDA

View Full Version : QWizard produces SIGILL



lauwe
6th March 2011, 16:34
I have a slot in my 'MainWindow' which is called from another thread and is supposed to show a QWizard (to reconnect some socket-connection). This is the code for this slot:



void
MainWindow::_reconnect(void) {

QWizard wiz();
ConnectionPage connectionPage(_project->getSettings());
wiz.setWindowTitle("Title");
wiz.addPage(&connectionPage);

if(wiz.exec() != QDialog::Accepted) {
delete _project;
_project = NULL;
return;
}
}


The problem is that when wiz.setWindowTitle (or any other method of QWizard) is called, a SIGILL occurs. The following is the trace:


0 ?? 0 0x4ec8356
1 QApplication::notify qapplication.cpp 4427 0x9abc60
2 QCoreApplication::notifyInternal qcoreapplication.cpp 731 0x6a2015f8
3 QCoreApplication::sendEvent qcoreapplication.h 215 0x1024e3a
4 QWidget::setWindowTitle qwidget.cpp 6005 0x9f1c6a
5 MainWindow::_reconnect mainwindow.cpp 273 0x40355e
...


When I change the code in the slot to show a QMessageBox (in a similar way) everything is fine.

What could cause this?

wysota
6th March 2011, 18:17
QWizard wiz();
is a declaration of a method called "wiz" taking no arguments and returning a QWizard object. You probably wanted this:

QWizard wiz;

Your current code shouldn't even compile.

lauwe
6th March 2011, 19:29
I'm sorry, indeed this does not compile and I meant


QWizard wiz


I had tried to pass a pointer to the constructor to make MainWindow its parent (which changed nothing).

wysota
6th March 2011, 19:46
Change line #5 to:

ConnectionPage *connectionPage = new ConnectionPage(_project->getSettings());
and adjust the next two lines accordingly.