From 43a1216dcb4a4e381a0c917f8eb9db89119073d7 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Wed, 21 Jan 2015 20:47:21 +0000 Subject: HistoryStats: -Fixed memory leak -minor cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@11890 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/HistoryStats/src/column_split.cpp | 2 +- plugins/HistoryStats/src/column_splittimeline.cpp | 2 +- plugins/HistoryStats/src/statistic.cpp | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'plugins/HistoryStats') diff --git a/plugins/HistoryStats/src/column_split.cpp b/plugins/HistoryStats/src/column_split.cpp index 48d47b579f..7a21a97940 100644 --- a/plugins/HistoryStats/src/column_split.cpp +++ b/plugins/HistoryStats/src/column_split.cpp @@ -318,7 +318,7 @@ ColSplit::SplitParams ColSplit::getParams() const } break; - case 2: // custom + default: // custom { params.alignment = m_nGraphAlign; params.hours_in_block = unitFactors[m_nBlockUnit] * m_nUnitsPerBlock; diff --git a/plugins/HistoryStats/src/column_splittimeline.cpp b/plugins/HistoryStats/src/column_splittimeline.cpp index f28bc6cb6d..77e1211241 100644 --- a/plugins/HistoryStats/src/column_splittimeline.cpp +++ b/plugins/HistoryStats/src/column_splittimeline.cpp @@ -397,7 +397,7 @@ ColSplitTimeline::SplitParams ColSplitTimeline::getParams() const } break; - case 2: // custom + default: // custom { params.alignment = m_nGraphAlign; params.columns_to_group = m_nCustomGroup; diff --git a/plugins/HistoryStats/src/statistic.cpp b/plugins/HistoryStats/src/statistic.cpp index 3a202f3f09..61647087cd 100644 --- a/plugins/HistoryStats/src/statistic.cpp +++ b/plugins/HistoryStats/src/statistic.cpp @@ -1477,15 +1477,16 @@ void Statistic::run(const Settings& settings, InvocationSource invokedFrom, HINS m_bRunning = true; - // create object holding and performing the statistics - Statistic* pStats = new Statistic(settings, invokedFrom, hInst); - + HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); // create event for thread stack unwinding - if ((pStats->m_hThreadPushEvent = CreateEvent(NULL, FALSE, FALSE, NULL)) == NULL) { + if (hEvent == NULL) { m_bRunning = false; return; } + // create object holding and performing the statistics + Statistic *pStats = new Statistic(settings, invokedFrom, hInst); + pStats->m_hThreadPushEvent = hEvent; // create worker thread DWORD dwThreadID = 0; HANDLE hThread = CreateThread(NULL, 0, threadProc, pStats, 0, &dwThreadID); -- cgit v1.2.3