From 643477de2fc0a5e66e0254d86f753101c3ca7335 Mon Sep 17 00:00:00 2001 From: LePresidente Date: Tue, 24 Oct 2017 13:56:06 +0200 Subject: Updated dll manifest. --- src/dlls.manifest.qt5 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/dlls.manifest.qt5 b/src/dlls.manifest.qt5 index dd0b4ea9..2a3cfeb0 100644 --- a/src/dlls.manifest.qt5 +++ b/src/dlls.manifest.qt5 @@ -3,11 +3,12 @@ - - - + + + + @@ -16,10 +17,12 @@ - + + + - + \ No newline at end of file -- cgit v1.3.1 From 139ee36a3f0cc8b628d93edc890df19170adeac6 Mon Sep 17 00:00:00 2001 From: LePresidente Date: Thu, 26 Oct 2017 15:50:35 +0200 Subject: Fixes https://github.com/LePresidente/modorganizer/issues/108 --- src/mainwindow.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 79be617b..158e32d1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -840,6 +840,7 @@ void MainWindow::showEvent(QShowEvent *event) m_OrganizerCore.settings().registerAsNXMHandler(false); m_WasVisible = true; + updateProblemsButton(); } } -- cgit v1.3.1 From ebe6011174767687f3b575c08132a720ecccbf55 Mon Sep 17 00:00:00 2001 From: LePresidente Date: Sat, 28 Oct 2017 08:30:23 +0200 Subject: Fixes the handle leak in the OrganizerCore::waitForProcessCompletion --- src/organizercore.cpp | 103 +++++++++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/organizercore.cpp b/src/organizercore.cpp index c55504a8..9ae8beae 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1239,7 +1239,7 @@ bool OrganizerCore::waitForApplication(HANDLE handle, LPDWORD exitCode) bool OrganizerCore::waitForProcessCompletion(HANDLE handle, LPDWORD exitCode) { HANDLE processHandle = handle; - + static const DWORD maxCount = 5; size_t numProcesses = maxCount; LPDWORD processes = new DWORD[maxCount]; @@ -1250,62 +1250,63 @@ bool OrganizerCore::waitForProcessCompletion(HANDLE handle, LPDWORD exitCode) DWORD res; // Wait for a an event on the handle, a key press, mouse click or timeout //TODO: Remove MOBase::isOneOf from this query as it was always returning true. + while ( - res = ::MsgWaitForMultipleObjects(1, &handle, false, 500, - QS_KEY | QS_MOUSE), - ((res != WAIT_FAILED) || (res != WAIT_OBJECT_0)) && - ((m_UserInterface == nullptr) || !m_UserInterface->unlockClicked())) { - - if (!::GetVFSProcessList(&numProcesses, processes)) { - break; - } - - bool found = false; - size_t count = - std::min(static_cast(maxCount), numProcesses); - for (size_t i = 0; i < count; ++i) { - std::wstring processName = getProcessName(processes[i]); - if (!boost::starts_with(processName, L"ModOrganizer.exe")) { - currentProcess = processes[i]; - m_UserInterface->setProcessName(QString::fromStdWString(processName)); - processHandle = ::OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, currentProcess); - found = true; + res = ::MsgWaitForMultipleObjects(1, &handle, false, 500, + QS_KEY | QS_MOUSE), + ((res != WAIT_FAILED) || (res != WAIT_OBJECT_0)) && + ((m_UserInterface == nullptr) || !m_UserInterface->unlockClicked())) { + + if (!::GetVFSProcessList(&numProcesses, processes)) { + break; + } + bool found = false; + size_t count = + std::min(static_cast(maxCount), numProcesses); + for (size_t i = 0; i < count; ++i) { + std::wstring processName = getProcessName(processes[i]); + if (!boost::starts_with(processName, L"ModOrganizer.exe")){ + currentProcess = processes[i]; + m_UserInterface->setProcessName(QString::fromStdWString(processName)); + processHandle = ::OpenProcess(SYNCHRONIZE, FALSE, currentProcess); + found = true; + ::CloseHandle(processHandle); + } } - } - if (!found) { - // it's possible the previous process has deregistered before - // the new one has registered, so we should try one more time - // with a little delay - if (tryAgain) { - tryAgain = false; - QThread::msleep(500); - continue; + if (!found) { + // it's possible the previous process has deregistered before + // the new one has registered, so we should try one more time + // with a little delay + if (tryAgain) { + tryAgain = false; + QThread::msleep(500); + continue; + } else { + break; + } } else { - break; + tryAgain = true; + } + // keep processing events so the app doesn't appear dead + + QCoreApplication::processEvents(); + + + if (exitCode != nullptr) { + //This is actually wrong if the process we started finished before we + //got the event and so we end up with a job handle. + if (! ::GetExitCodeProcess(processHandle, exitCode)) + { + DWORD error = ::GetLastError(); + qDebug() << "Failed to get process exit code: Error " << error; + } } - } else { - tryAgain = true; - } - - // keep processing events so the app doesn't appear dead - QCoreApplication::processEvents(); - } - if (exitCode != nullptr) { - //This is actually wrong if the process we started finished before we - //got the event and so we end up with a job handle. - if (! ::GetExitCodeProcess(processHandle, exitCode)) - { - DWORD error = ::GetLastError(); - qDebug() << "Failed to get process exit code: Error " << error; + ::CloseHandle(processHandle); + if (handle != processHandle) { + ::CloseHandle(handle); + } } - } - - ::CloseHandle(processHandle); - if (handle != processHandle) { - ::CloseHandle(handle); - } - return res == WAIT_OBJECT_0; } -- cgit v1.3.1