diff options
author | Andreas Kling <info@andreaskling.com> | 2009-10-23 11:16:28 (GMT) |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2009-10-23 11:20:07 (GMT) |
commit | c51f6afd07a55692e3f00c8e0a5d5c61b13ffefa (patch) | |
tree | bba0d1bc0ce21eb67c69d5c22879ec55135d756e /src/gui/dialogs | |
parent | d6af21c0c8c842b684064a63cd37575720bc0ed9 (diff) | |
download | Qt-c51f6afd07a55692e3f00c8e0a5d5c61b13ffefa.zip Qt-c51f6afd07a55692e3f00c8e0a5d5c61b13ffefa.tar.gz Qt-c51f6afd07a55692e3f00c8e0a5d5c61b13ffefa.tar.bz2 |
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 8e4c461..637b852 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(); |