Patched Qt's QProcess class to pass the CREATE_BREAKAWAY_FROM_JOB flag when creating a new process. This is required, because Windows (Vista and later) will add our child processes to the PCA (Program Compatibility Assistant) job object automatically! And then we cannot add the child processes to our own job object, as a process can be assigned to only one job object. With the CREATE_BREAKAWAY_FROM_JOB flag, we ensure that our child processes does NOT get added to the PCA job object automatically and we can add it to our own job object again. Unfortunately QProcess does NOT provide a way to pass process creation flags yet, so we have to patch Qt for now. Passing the CREATE_BREAKAWAY_FROM_JOB flag may not always be desired though...

This commit is contained in:
LoRd_MuldeR 2012-03-01 23:14:41 +01:00
parent 2ee08c5f4b
commit a450862150
3 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,21 @@
diff --git "a/E:\\QtSDK\\QtSources\\4.8.0\\src\\corelib\\io\\qprocess_win.old" "b/E:\\QtSDK\\QtSources\\4.8.0\\src\\corelib\\io\\qprocess_win.cpp"
index 510f723..e82bbec 100644
--- "a/E:\\QtSDK\\QtSources\\4.8.0\\src\\corelib\\io\\qprocess_win.old"
+++ "b/E:\\QtSDK\\QtSources\\4.8.0\\src\\corelib\\io\\qprocess_win.cpp"
@@ -413,6 +413,7 @@ void QProcessPrivate::startProcess()
#else
DWORD dwCreationFlags = CREATE_NO_WINDOW;
dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT;
+ dwCreationFlags |= CREATE_BREAKAWAY_FROM_JOB;
STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0,
(ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
(ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
@@ -858,7 +859,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
success = CreateProcess(0, (wchar_t*)args.utf16(),
- 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0,
+ 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE | CREATE_BREAKAWAY_FROM_JOB, 0,
workingDir.isEmpty() ? 0 : (wchar_t*)workingDir.utf16(),
&startupInfo, &pinfo);
#endif // Q_OS_WINCE

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 4
#define VER_LAMEXP_TYPE Beta
#define VER_LAMEXP_PATCH 3
#define VER_LAMEXP_BUILD 897
#define VER_LAMEXP_BUILD 898
///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!)

View File

@ -94,6 +94,10 @@ AbstractTool::AbstractTool(void)
CloseHandle(jobObject);
}
}
else
{
qWarning("Failed to create the job object!");
}
}
}
else