PDA

View Full Version : QMessageBox memory problem



Jeffb
4th January 2012, 23:46
Hi guys

Have been using this code with no problem up until now.
Now its suddenly started crashing when it gets to aMB.exec();
with memory bad access.
Signal name :
EXC_BAD_ACCESS

Has anyone got any ideas what might be happening.
I have cleaned and rebuilt and even turned the machine off and back on again.
Am using Mac OS X Lion.

Thanks.
Jeff


void JB_Utilities::debugMB(const QString &text,
QWidget* parent,
Qt::WindowModality aWindowModality)
{
cout << "ERROR: " << qPrintable(text) << endl;
QMessageBox aMB(QMessageBox::Warning,
"ERROR",
text,
QMessageBox::Ok,
parent);
aMB.setWindowModality(aWindowModality);
aMB.setDefaultButton(QMessageBox::Ok);
aMB.exec();
}

ChrisW67
5th January 2012, 04:31
Check that parent is a valid pointer or null/zero.

Jeffb
5th January 2012, 12:03
@Chris

I'm definitely passing zero into the method for the parent.

amleto
5th January 2012, 20:27
presumably this is with debug build? what is the call stack? do you have multiple qt installs?

ChrisW67
5th January 2012, 22:22
Does the problem persist after a clean and full rebuild?

Jeffb
8th January 2012, 10:48
Yes it continued after a complete clean and rebuild.
Its being called from another method of JB_Utilities.

When called from an entirely different object, it has no problems.

The call stack shows it getting to .exec and then crashing.
There is only one qt install.

The code is simply there to tell me when there is a problem.
In this case I can get around it by making sure the code that calls it never gets executed (which is the way it should be).
But I still hate not knowing what is going on.

Cheers
Jeff

Lykurg
8th January 2012, 11:09
May be this article helps: http://blogs.kde.org/node/3919.