diff options
author | Andreas Kling <info@andreaskling.com> | 2009-10-23 13:16:28 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2009-10-23 13:20:07 +0200 |
commit | c51f6afd07a55692e3f00c8e0a5d5c61b13ffefa (patch) | |
tree | bba0d1bc0ce21eb67c69d5c22879ec55135d756e /src/gui/dialogs | |
parent | d6af21c0c8c842b684064a63cd37575720bc0ed9 (diff) | |
download | qt4-tools-c51f6afd07a55692e3f00c8e0a5d5c61b13ffefa.tar.gz |
Fix weird behavior when opening a QFileDialog for non-current directory.
shouldShowFileName() can be called with an empty filename, but must not
create and use a QFileInfo("") since that has known undefined behavior.
So just return NO right away for empty filenames.
Merge-request: 1765
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@nokia.com>
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r-- | src/gui/dialogs/qfiledialog_mac.mm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index 8e4c461164..637b852121 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -280,6 +280,11 @@ QT_USE_NAMESPACE - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename { Q_UNUSED(sender); + + // Don't bother with empty file names. + if ([filename length] == 0) + return NO; + QString qtFileName = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)(filename); QFileInfo info(qtFileName.normalized(QT_PREPEND_NAMESPACE(QString::NormalizationForm_C))); QString path = info.absolutePath(); |