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
Qt Code:
  1. void MyFunc::openCFGFile(void)
  2. {
  3. QString strFile = QFileDialog::getOpenFileName(this,
  4. tr("Select Configuration File To Open"),"",
  5. "Configuration File (*.cfg)"); // <--segmentation fault happen here
  6. if (strFile.isEmpty())
  7. return;
  8. //store cfgFile
  9. cfgFile = new QFile(strFile);
  10. if (!cfgFile->open(QFile::ReadOnly))
  11. {
  12. QMessageBox::warning(this, tr("File Open Error"),
  13. tr("Cannot Open file %1:\n%2.")
  14. .arg(strFile)
  15. .arg(cfgFile->errorString()));
  16. cfgFile->close();
  17. return;
  18. }
  19. cfgFile->close();
  20. }
To copy to clipboard, switch view to plain text mode 

please tell me what did i do wrong?

baray98