From ddbdc711119e102ce751e7faf8b9d77521707058 Mon Sep 17 00:00:00 2001 From: Brian Ferguson Date: Thu, 7 Mar 2013 22:53:58 -0700 Subject: [PATCH] FileView: Fixed heap corruption. --- Plugins/PluginFileView/PluginFileView.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Plugins/PluginFileView/PluginFileView.cpp b/Plugins/PluginFileView/PluginFileView.cpp index c7b4bac5..4d736a69 100644 --- a/Plugins/PluginFileView/PluginFileView.cpp +++ b/Plugins/PluginFileView/PluginFileView.cpp @@ -650,21 +650,18 @@ PLUGIN_EXPORT void Finalize(void* data) ParentMeasure* parent = child->parent; EnterCriticalSection(&g_CriticalSection); - if (parent->thread) - { - TerminateThread(parent->thread, 0); - parent->thread = nullptr; - } - if (parent && parent->ownerChild == child) { - CloseHandle(parent->thread); - parent->thread = nullptr; - - delete parent; + if (parent->thread) + { + TerminateThread(parent->thread, 0); + parent->thread = nullptr; + } auto iter = std::find(g_ParentMeasures.begin(), g_ParentMeasures.end(), parent); g_ParentMeasures.erase(iter); + + delete parent; } delete child;