From b1b4625a066c470eee73012e6ce1443419695d44 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Thu, 2 Aug 2018 01:06:01 -0400 Subject: [PATCH] bugfix --- texthook/textthread.cc | 4 +++- texthook/textthread.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/texthook/textthread.cc b/texthook/textthread.cc index 6164628..74177b3 100644 --- a/texthook/textthread.cc +++ b/texthook/textthread.cc @@ -17,6 +17,7 @@ TextThread::TextThread(ThreadParameter tp, unsigned int threadNumber, unsigned i storage(), sentenceBuffer(), status(0), + flushTimer(0), threadNumber(threadNumber), splitDelay(splitDelay), output(nullptr), @@ -28,6 +29,7 @@ TextThread::TextThread(ThreadParameter tp, unsigned int threadNumber, unsigned i TextThread::~TextThread() { EnterCriticalSection(&ttCs); + KillTimer(dummyWindow, flushTimer); LeaveCriticalSection(&ttCs); DeleteCriticalSection(&ttCs); } @@ -75,7 +77,7 @@ void TextThread::AddText(const BYTE *con, int len) { TT_LOCK; sentenceBuffer.insert(sentenceBuffer.end(), con, con + len); - SetTimer(dummyWindow, (UINT_PTR)this, splitDelay, + flushTimer = SetTimer(dummyWindow, (UINT_PTR)this, splitDelay, [](HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) { KillTimer(hWnd, idEvent); diff --git a/texthook/textthread.h b/texthook/textthread.h index 249869c..10711b7 100644 --- a/texthook/textthread.h +++ b/texthook/textthread.h @@ -57,6 +57,7 @@ private: unsigned int threadNumber; unsigned int splitDelay; DWORD status; + unsigned int flushTimer; }; // EOF