PDA

View Full Version : Memory problems, please help!



Slewman
22nd October 2009, 16:49
I have an application that has given me no problems for the last week... I boot it up this morning and all of a sudden I am getting unhandled exceptions that point to a memory leak of some sort... I have been trying to figure out why and fix it, but have come up empty handed.



void WInterface::toggleCueingSize()
{
QPushButton *clickedButton = qobject_cast<QPushButton *>(sender());
if (clickedButton != 0)
{
std::string compareString = clickedButton->objectName().toStdString();
if (compareString.compare("bannerSensorSelectButton")==0)
{
ui->wBannerSensorDisplay->show();
ui->wSensorOnlyDisplay->hide();
ui->viewModeSettings->hide();
}
else if (compareString.compare("sensorOnlySelectButton")==0)
{
ui->wBannerSensorDisplay->hide();
ui->wSensorOnlyDisplay->show();
ui->viewModeSettings->hide();
}
else if (ui->weaponsSensorOnlyDisplay->isHidden())
{
ui->wBannerSensorDisplay->hide();
ui->wSensorOnlyDisplay->show();
}
else
{
ui->wBannerSensorDisplay->show();
ui->wSensorOnlyDisplay->hide();
}
}
}


this code gives me this error:

HEAP[PresQT.exe]: Invalid Address specified to RtlFreeHeap( 003F0000, 02C45BA0 )
Unhandled exception at 0x7c90120e in PresQT.exe: User breakpoint.

and it is crashing somewhere in free.c

I have commented out the the QPushButton assignment along with the string and the 2 conditional statements that involve the string, and it works fine... so it has something to do with the dynamic cast and the string assignment, but i dont know why or where the problem is...

anyone have any idea? help is greatly appreciated!

Slewman
22nd October 2009, 19:14
found the problem... apparently getObject() is an unstable function... switched to text() and now have no problems