From c7c172d368f0362911c28c4c12551c7162cf4034 Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Mon, 27 Mar 2017 14:23:03 -0400 Subject: [PATCH] Fix FP_LOADER_THREAD resource leak The mechanism of thread termination was changed in 61c2beea and not done correctly - the thread was not notified that it should terminate. --- pcbnew/footprint_preview_panel.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pcbnew/footprint_preview_panel.cpp b/pcbnew/footprint_preview_panel.cpp index 974a6a579b..27602f1360 100644 --- a/pcbnew/footprint_preview_panel.cpp +++ b/pcbnew/footprint_preview_panel.cpp @@ -123,6 +123,15 @@ class FP_THREAD_IFACE m_panel = aPanel; } + /** + * Get the associated panel. + */ + FOOTPRINT_PREVIEW_PANEL* GetPanel() + { + MUTLOCK lock( m_lock ); + return m_panel; + } + /** * Post an event to the panel, if the panel still exists. Return whether * the event was posted. @@ -217,7 +226,7 @@ public: virtual void* Entry() override { - while( !TestDestroy() ) + while( m_iface->GetPanel() ) { auto ent = m_iface->PopFromQueue(); @@ -227,7 +236,7 @@ public: wxMilliSleep( 100 ); } - return NULL; + return nullptr; } };