QMessageBox::information always crashes
for no apparent reason, I can't get QMessageBox::information to work in my current application. It always crashes even in the simplest cases.
for example, even this causes a crash.
Code:
myAbout
= new QAction(tr
("About"),
this);
connect(myAbout, SIGNAL(triggered()), SLOT(aboutClicked()));
#if defined(Q_OS_SYMBIAN) && defined(USE_ACTIONS)
menuBar()->addAction(myAbout);
#endif
void myApplication::aboutClicked()
{
qDebug() << "myApplication::aboutClicked()";
QMessageBox::information ( this, APP_NAME,
"Some text" );
//QMessageBox::information ( 0, APP_NAME, "Some text" );
}
I do have a couple of threads running, but the QMessageBox is always called from the main UI thread. Any ideas?
Re: QMessageBox::information always crashes
Could you provide a debugger backtrace from the crash?
Re: QMessageBox::information always crashes
Should your connect have 4 arguments instead of 3?
Instead of:
connect(myAbout, SIGNAL(triggered()), SLOT(aboutClicked()));
try:
connect(myAbout, SIGNAL(triggered()), myAbout, SLOT(aboutClicked()));
Hope this helps.
Re: QMessageBox::information always crashes
As Tito said, the connection works and
Code:
connect(myAbout, SIGNAL(triggered()), SLOT(aboutClicked()));
is a shorthand for
Code:
connect(myAbout, SIGNAL(triggered()), this, SLOT(aboutClicked()));
. See QObject::connect().
Re: QMessageBox::information always crashes
the problem isn't with the connect.... You only need 4 arguments if the slot object is different from the signal object.
As for the error, I've simplified it even more... the messagebox is being sent up as the first thing in the mainwindow creation.. which works on a blank project, but not here..
unfortunately the debug stack isn't helpful.
Thread [Thread id: 758] (Suspended: Signal 'Exception 0' received. Description: A data abort exception has occurred..)
2 Unknown (0x7971C6FA)() 0x7971c6fa
1 Unknown (0x7971CD60)() 0x7971cd60
hmmm.....
Re: QMessageBox::information always crashes
And the lesson today is... don't mess with TARGET.EPOCSTACKSIZE...:mad: let Qt sort it out for itself.
Wow.. what a waste of time that was.