Merge remote-tracking branch 'origin/4.7' into 4.8

Change-Id: Ia215af4ddad73053582284d3ce8d56b92dbbc8f3
This commit is contained in:
Eike Ziller
2018-09-27 09:07:07 +02:00
2 changed files with 26 additions and 7 deletions

View File

@@ -25,9 +25,15 @@ C++ Support
* Clang Code Model * Clang Code Model
* Fixed include order for Clang headers * Fixed include order for Clang headers
QML Support
* Fixed that comments could break reformatting (QTCREATORBUG-21036)
Debugging Debugging
* Fixed remote debugging command line argument (QTCREATORBUG-20928) * Fixed remote debugging command line argument (QTCREATORBUG-20928)
* Fixed environment for `Start and Debug External Application`
(QTCREATORBUG-20185)
* GDB * GDB
* Fixed GDB built-in pretty printer handling (QTCREATORBUG-20770) * Fixed GDB built-in pretty printer handling (QTCREATORBUG-20770)
* CDB * CDB

View File

@@ -128,13 +128,25 @@ bool SaveFile::commit()
fileName().toStdWString().data(), fileName().toStdWString().data(),
nullptr, REPLACEFILE_IGNORE_MERGE_ERRORS, nullptr, nullptr); nullptr, REPLACEFILE_IGNORE_MERGE_ERRORS, nullptr, nullptr);
if (!result) { if (!result) {
const DWORD replaceErrorCode = GetLastError(); DWORD replaceErrorCode = GetLastError();
QString errorStr; QString errorStr;
if (!QFile::exists(finalFileName)) { if (!QFile::exists(finalFileName)) {
// Replace failed because finalFileName does not exist, try rename. // Replace failed because finalFileName does not exist, try rename.
if (!(result = rename(finalFileName))) if (!(result = rename(finalFileName)))
errorStr = errorString(); errorStr = errorString();
} else { } else {
if (replaceErrorCode == ERROR_UNABLE_TO_REMOVE_REPLACED) {
// If we do not get the rights to remove the original final file we still might try
// to replace the file contents
result = MoveFileEx(fileName().toStdWString().data(),
finalFileName.toStdWString().data(),
MOVEFILE_COPY_ALLOWED
| MOVEFILE_REPLACE_EXISTING
| MOVEFILE_WRITE_THROUGH);
if (!result)
replaceErrorCode = GetLastError();
}
if (!result) {
wchar_t messageBuffer[256]; wchar_t messageBuffer[256];
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr, replaceErrorCode, nullptr, replaceErrorCode,
@@ -142,6 +154,7 @@ bool SaveFile::commit()
messageBuffer, sizeof(messageBuffer), nullptr); messageBuffer, sizeof(messageBuffer), nullptr);
errorStr = QString::fromWCharArray(messageBuffer); errorStr = QString::fromWCharArray(messageBuffer);
} }
}
if (!result) { if (!result) {
remove(); remove();
setErrorString(errorStr); setErrorString(errorStr);