diff options
author | Robin KAY <komadori@gekkou.co.uk> | 2014-06-24 23:35:22 +0100 |
---|---|---|
committer | Robin KAY <komadori@gekkou.co.uk> | 2014-06-27 21:11:30 +0200 |
commit | 5da2576633bc0d0150a8607a30ab1f66f040bb19 (patch) | |
tree | eb54865132bee1136f9a4310ee8a98e4fc17f5c2 | |
parent | 03140436555ad916fbbf77436d567595c614c595 (diff) |
Fix intermittent crash with older MinGW releases
An alternate code-path was previously added to work around a bad
signature for the SHParseDisplayName() function in older and non-w64
versions of the MinGW headers. This code-path incorrectly passed a
single rather double indirect pointer to the third argument of that
function causing it to produce corrupt data and subsequently crash.
This change modifies the code to instead cast a pointer of the correct
type to the incorrect type expected by the headers.
Task-number: QTBUG-39793
Change-Id: I4d65dea4fc38d7e885468cd23434d8570c311fc2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 0424c57f97..70d0c3ad40 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -2306,20 +2306,17 @@ static inline QString shellNormalizeFileName(const QString &name) // The correct declaration of the SHGetPathFromIDList symbol is // being used in mingw-w64 as of r6215, which is a v3 snapshot. #if defined(Q_CC_MINGW) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3) - ITEMIDLIST file; - if (FAILED(SHParseDisplayName(nameC, NULL, &file, 0, NULL))) - return name; - TCHAR buffer[MAX_PATH]; - if (!SHGetPathFromIDList(&file, buffer)) + ITEMIDLIST *file; + if (FAILED(SHParseDisplayName(nameC, NULL, reinterpret_cast<LPITEMIDLIST>(&file), 0, NULL))) return name; #else PIDLIST_ABSOLUTE file; if (FAILED(SHParseDisplayName(nameC, NULL, &file, 0, NULL))) return name; +#endif TCHAR buffer[MAX_PATH]; if (!SHGetPathFromIDList(file, buffer)) return name; -#endif QString canonicalName = QString::fromWCharArray(buffer); // Upper case drive letter if (canonicalName.size() > 2 && canonicalName.at(1) == QLatin1Char(':')) |