QProcess/Windows: Fix handling of workingDirectory.

Store nativeWorkingDirectory in a variable on the stack to prevent
accessing the buffer of a temporary string.
Fix breakage introduced by 068baa9bb6d526cccc0c8bc7cdbb84bbdf137f95.

Change-Id: I8cf9ffe39c97afc9383c33cafaeffb1245b3e2b9
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2015-12-14 16:45:23 +01:00
parent a8ff0bc887
commit 3c8cf55074

View File

@ -498,11 +498,12 @@ void QProcessPrivate::startProcess()
stdinChannel.pipe[0], stdoutChannel.pipe[1], stderrChannel.pipe[1]
};
const QString nativeWorkingDirectory = QDir::toNativeSeparators(workingDirectory);
QProcess::CreateProcessArguments cpargs = {
0, (wchar_t*)args.utf16(),
0, 0, TRUE, dwCreationFlags,
environment.isEmpty() ? 0 : envlist.data(),
workingDirectory.isEmpty() ? 0 : (wchar_t*)QDir::toNativeSeparators(workingDirectory).utf16(),
nativeWorkingDirectory.isEmpty() ? Q_NULLPTR : (wchar_t*)nativeWorkingDirectory.utf16(),
&startupInfo, pid
};
if (modifyCreateProcessArgs)