Details
-
Type:
Bug
-
Status: Closed
-
Priority:
P4: Low
-
Resolution: Done
-
Affects Version/s: 4.8.6
-
Fix Version/s: 4.8.7
-
Component/s: QPA: Windows
-
Labels:None
-
Environment:Windows
-
Commits:933ae21b9925f1d9fc467e1ecb72eb91b5892d61 (qt/4.8, 5.12.2014, 4.8.7)
Description
qdesktopservices_win.cpp
#if defined Q_WS_WINCE if (SHGetSpecialFolderPath(0, path, CSIDL_APPDATA, FALSE)) #else if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE)) #endif result = QString::fromWCharArray(path); if (!QCoreApplication::organizationName().isEmpty()) result = result + QLatin1String("\\") + QCoreApplication::organizationName(); if (!QCoreApplication::applicationName().isEmpty()) result = result + QLatin1String("\\") + QCoreApplication::applicationName(); break;
If SHGetSpecialFolderPath returns FALSE because it failed, result should not be set and is not set by the string path.
But neither QLatin1String("
") + QCoreApplication::organizationName(); nor result = result + QLatin1String("
") + QCoreApplication::applicationName(); should be appended if SHGetSpecialFolderPath failed.
So the code should be changed to:
qdesktopservices_win.cpp
#if defined Q_WS_WINCE if (SHGetSpecialFolderPath(0, path, CSIDL_APPDATA, FALSE)) #else if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE)) #endif result = QString::fromWCharArray(path); if (!result.isEmpty() && !QCoreApplication::organizationName().isEmpty()) result = result + QLatin1String("\\") + QCoreApplication::organizationName(); if (!result.isEmpty() && !QCoreApplication::applicationName().isEmpty()) result = result + QLatin1String("\\") + QCoreApplication::applicationName(); break;