This commit is contained in:
Akash Mozumdar 2018-10-30 21:21:21 -04:00
parent 69e01dab7c
commit 8e45b35ebe
3 changed files with 33 additions and 30 deletions

View File

@ -44,12 +44,12 @@ namespace
{ {
LOCK(hostMutex); LOCK(hostMutex);
std::vector<ThreadParam> removedThreads; std::vector<ThreadParam> removedThreads;
for (auto i : textThreadsByParams) for (auto[tp, thread] : textThreadsByParams)
if (removeIf(i.first)) if (removeIf(tp))
{ {
OnRemove(i.second); OnRemove(thread);
//delete i.second; // Artikash 7/24/2018: FIXME: Qt GUI updates on another thread, so I can't delete this yet. //delete i.second; // Artikash 7/24/2018: FIXME: Qt GUI updates on another thread, so I can't delete this yet.
removedThreads.push_back(i.first); removedThreads.push_back(tp);
} }
for (auto thread : removedThreads) textThreadsByParams.erase(thread); for (auto thread : removedThreads) textThreadsByParams.erase(thread);
} }
@ -153,7 +153,7 @@ namespace Host
#ifdef _DEBUG // Check memory leaks #ifdef _DEBUG // Check memory leaks
LOCK(hostMutex); LOCK(hostMutex);
OnRemove = [](TextThread* textThread) { delete textThread; }; OnRemove = [](TextThread* textThread) { delete textThread; };
for (auto i : processRecordsByIds) UnregisterProcess(i.first); for (auto[pid, pr] : processRecordsByIds) UnregisterProcess(pid);
delete textThreadsByParams[CONSOLE]; delete textThreadsByParams[CONSOLE];
#endif #endif
} }

View File

@ -2,6 +2,8 @@
#include <sstream> #include <sstream>
#include <QApplication> #include <QApplication>
namespace
{
char* GetCppExceptionInfo(EXCEPTION_POINTERS* exception) char* GetCppExceptionInfo(EXCEPTION_POINTERS* exception)
{ {
// See https://blogs.msdn.microsoft.com/oldnewthing/20100730-00/?p=13273 // See https://blogs.msdn.microsoft.com/oldnewthing/20100730-00/?p=13273
@ -33,6 +35,7 @@ LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS* exception)
return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_CONTINUE_SEARCH;
} }
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {

View File

@ -6,8 +6,8 @@ bool RemoveRepeatedChars(std::wstring& sentence)
{ {
int repeatNumber = 0; int repeatNumber = 0;
wchar_t prevChar = sentence[0]; wchar_t prevChar = sentence[0];
for (auto i : sentence) for (auto c : sentence)
if (i == prevChar) repeatNumber++; if (c == prevChar) repeatNumber++;
else break; else break;
if (repeatNumber == 1) return false; if (repeatNumber == 1) return false;