summaryrefslogtreecommitdiff
path: root/src/processrunner.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-12-29 07:16:09 -0500
committerisanae <14251494+isanae@users.noreply.github.com>2019-12-29 07:16:09 -0500
commit52cc3a41c73851d88983223361c03b800db8c2a2 (patch)
tree294a8bd7790e8f2c976d79a8a29622e550179ab1 /src/processrunner.cpp
parentdc6653e1009a8081cd4bae7ba15751b9cc6b5e4b (diff)
refresh after manually unlocking the ui
fixed nexus connect button staying as "cancel" in case of errors fixed logging of duplicate dll loading bumped to rc6
Diffstat (limited to 'src/processrunner.cpp')
-rw-r--r--src/processrunner.cpp56
1 files changed, 43 insertions, 13 deletions
diff --git a/src/processrunner.cpp b/src/processrunner.cpp
index 3f1e3a3b..91443750 100644
--- a/src/processrunner.cpp
+++ b/src/processrunner.cpp
@@ -795,6 +795,48 @@ std::optional<ProcessRunner::Results> ProcessRunner::runBinary()
return {};
}
+bool ProcessRunner::shouldRefresh(Results r) const
+{
+ // afterRun() is only called with the Refresh flag; it refreshes the
+ // directory structure and notifies plugins
+ //
+ // refreshing is not always required and can actually cause problems:
+ //
+ // 1) running shortcuts doesn't need refreshing because MO closes right
+ // after
+ //
+ // 2) the mod info dialog is not set up to deal with refreshes, so that
+ // it will crash because the old DirectoryEntry's are still being used
+ // in the list
+ if (!m_waitFlags.testFlag(Refresh)) {
+ log::debug("not refreshing because the flag isn't set");
+ return false;
+ }
+
+ switch (r)
+ {
+ case Completed:
+ {
+ log::debug("refreshing because the process completed");
+ return true;
+ }
+
+ case ForceUnlocked:
+ {
+ log::debug("refreshing because the ui was force unlocked");
+ return true;
+ }
+
+ case Error: // fall-through
+ case Cancelled:
+ case Running:
+ default:
+ {
+ return false;
+ }
+ }
+}
+
ProcessRunner::Results ProcessRunner::postRun()
{
const bool mustWait = (m_waitFlags & ForceWait);
@@ -841,19 +883,7 @@ ProcessRunner::Results ProcessRunner::postRun()
r = waitForProcess(m_handle.get(), &m_exitCode, ls);
});
- if (r == Completed && (m_waitFlags & Refresh)) {
- // afterRun() is only called with the Refresh flag; it refreshes the
- // directory structure and notifies plugins
- //
- // refreshing is not always required and can actually cause problems:
- //
- // 1) running shortcuts doesn't need refreshing because MO closes right
- // after
- //
- // 2) the mod info dialog is not set up to deal with refreshes, so that
- // it will crash because the old DirectoryEntry's are still being used
- // in the list
- //
+ if (shouldRefresh(r)) {
m_core.afterRun(m_sp.binary, m_exitCode);
}