summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-10-29 13:46:33 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-11-06 07:44:56 -0500
commit2aa70de49e89245467299d94d76825bad31c63a2 (patch)
treeb1dcf09f440af579f9765d5de5408f2bb8c81751 /src
parentf2cc71779feab647c508084c5dd5c175904c7f0f (diff)
return failure if the user has unlocked in waitForApplication()
Diffstat (limited to 'src')
-rw-r--r--src/processrunner.cpp34
-rw-r--r--src/processrunner.h3
2 files changed, 18 insertions, 19 deletions
diff --git a/src/processrunner.cpp b/src/processrunner.cpp
index 014f98ee..5d4a9fde 100644
--- a/src/processrunner.cpp
+++ b/src/processrunner.cpp
@@ -243,6 +243,14 @@ WaitResults waitForProcesses(
}
}
+WaitResults waitForProcess(
+ HANDLE initialProcess, LPDWORD exitCode, ILockedWaitingForProcess* uilock)
+{
+ std::vector<HANDLE> processes = {initialProcess};
+ return waitForProcesses(processes, exitCode, uilock);
+}
+
+
SpawnedProcess::SpawnedProcess(HANDLE handle, spawn::SpawnParameters sp)
: m_handle(handle), m_parameters(std::move(sp))
@@ -617,18 +625,20 @@ bool ProcessRunner::waitForProcessCompletionWithLock(
return true;
}
- bool r = false;
+ auto r = WaitResults::Error;
withLock([&](auto* uilock) {
- r = waitForProcessCompletion(handle, exitCode, uilock);
+ r = waitForProcess(handle, exitCode, uilock);
});
- return r;
+ // completed/unlocked is fine
+ return (r != WaitResults::Error);
}
bool ProcessRunner::waitForApplication(HANDLE handle, LPDWORD exitCode)
{
- // don't check for lockGUI() setting; this _always_ locks the ui
+ // don't check for lockGUI() setting; this _always_ locks the ui and waits
+ // for completion
//
// this is typically called only from OrganizerProxy, which allows plugins
// to wait on applications until they're finished
@@ -637,22 +647,14 @@ bool ProcessRunner::waitForApplication(HANDLE handle, LPDWORD exitCode)
// and then check the exit code; this has to work regardless of the locking
// setting
- bool r = false;
+ auto r = WaitResults::Error;
withLock([&](auto* uilock) {
- r = waitForProcessCompletion(handle, exitCode, uilock);
+ r = waitForProcess(handle, exitCode, uilock);
});
- return r;
-}
-
-bool ProcessRunner::waitForProcessCompletion(
- HANDLE handle, LPDWORD exitCode, ILockedWaitingForProcess* uilock)
-{
- std::vector<HANDLE> processes = {handle};
- const auto r = waitForProcesses(processes, exitCode, uilock);
-
- return (r != WaitResults::Error);
+ // treat unlocked as an error since this should always wait for completion
+ return (r == WaitResults::Completed);
}
bool ProcessRunner::waitForAllUSVFSProcessesWithLock()
diff --git a/src/processrunner.h b/src/processrunner.h
index d9423893..28f4da75 100644
--- a/src/processrunner.h
+++ b/src/processrunner.h
@@ -80,9 +80,6 @@ private:
bool waitForProcessCompletionWithLock(HANDLE handle, LPDWORD exitCode);
- bool waitForProcessCompletion(
- HANDLE handle, LPDWORD exitCode, ILockedWaitingForProcess* uilock);
-
bool waitForAllUSVFSProcesses(ILockedWaitingForProcess* uilock);
};