PDA

View Full Version : QFileDialog hang ups



baray98
27th October 2007, 00:58
I was trying to use QFileDialog::getOpenFileName static function,when i ran my app normally not in debugging mode it runs fine, but when i ran it in my debugger (GDB) i encountered some "segmentation fault"

please see my code below



void MyFunc::openCFGFile(void)
{
QString strFile = QFileDialog::getOpenFileName(this,
tr("Select Configuration File To Open"),"",
"Configuration File (*.cfg)"); // <--segmentation fault happen here
if (strFile.isEmpty())
return;
//store cfgFile
cfgFile = new QFile(strFile);
if (!cfgFile->open(QFile::ReadOnly))
{
QMessageBox::warning(this, tr("File Open Error"),
tr("Cannot Open file %1:\n%2.")
.arg(strFile)
.arg(cfgFile->errorString()));
cfgFile->close();
return;
}
cfgFile->close();
}


please tell me what did i do wrong?

baray98

elcuco
27th October 2007, 03:56
Used to happen to me on win32. Try using the non-native version (see the docs).\

Not sure why it happened.