View Full Version : QFileDialog's getOpenFileName crash in 10.5.x Leopard

28th February 2011, 04:40

When i m using QFileDialog::DontUseNativeDialog flags for Non-Native Dialog while getOpenFileName and getSaveFileName in 10.5.x Leopard..

On initiating dialog it repeatedly crashes.

I m using like this while Translation purpose in Japanese lang.
QString str = QFileDialog::getOpenFileName(this,tr("OPen"),QDir::currentPath(),NULL,NULL,QFileDialog::DontU seNativeDialog);

I m not figure out of this crash in 10.5.x


28th February 2011, 05:26
I'll take a guess assuming that this line is the actual cause: that's all that is possible without any description of the nature of the crash.

QString str = QFileDialog::getOpenFileName(
this, // parent, possible cause of crash if invalid or becomes invalid after dialog opens
tr("OPen"), // caption
QDir::currentPath(), // directory
NULL, // filter string (type should be const QString &)
NULL, // selected filter, null is default
QFileDialog::DontUseNativeDialog // options

From the QFileDialog::getOpenFileName() docs:

Only files that match the given filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter, and filter may be empty strings.

A null pointer is not an empty string so start there. Doesn't crash my Linux or Windows boxes though.

You could help your cause by using your debugger to see where it dies and reporting more information.