Exit right away if the parent process died

This commit is contained in:
Atlante45 2017-08-29 16:25:20 -07:00
parent 462ec30cac
commit 6b5b905b2a
2 changed files with 5 additions and 5 deletions

View file

@ -1081,7 +1081,7 @@ void setMaxCores(uint8_t maxCores) {
void quitWithParentProcess() {
if (qApp) {
qDebug() << "Parent process died, quitting";
qApp->quit();
exit(0);
}
}
@ -1134,7 +1134,7 @@ QString GetLastErrorAsString() {
return QString::fromStdString(message);
}
HANDLE createJobObject() {
void *createJobObject() {
HANDLE jobObject = CreateJobObject(nullptr, nullptr);
if (jobObject == nullptr) {
qWarning() << "Could NOT create job object:" << GetLastErrorAsString();
@ -1155,7 +1155,7 @@ HANDLE createJobObject() {
return jobObject;
}
void addProcessToJobObject(HANDLE jobObject, DWORD processId) {
void addProcessToJobObject(void *jobObject, qint64 processId) {
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId);
if (hProcess == nullptr) {
qCritical() << "Could NOT open process" << GetLastErrorAsString();

View file

@ -240,8 +240,8 @@ void watchParentProcess(int parentPID);
#ifdef _WIN32
HANDLE createJobObject();
void addProcessToJobObject(HANDLE jobObject, DWORD processId);
void *createJobObject();
void addProcessToJobObject(void *jobObject, qint64 processId);
#endif
#endif // hifi_SharedUtil_h