From 3dd8c57bdd3511ca0a9b03e16ddc9f5dde05a804 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Sun, 26 Dec 2021 08:29:54 -0500 Subject: [PATCH] Fix race condition with ShowEventCounters on Windows --- pcbnew/pcb_edit_frame.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 9ee8807d45..4a7fe78082 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -412,6 +412,13 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : PCB_EDIT_FRAME::~PCB_EDIT_FRAME() { + if( ADVANCED_CFG::GetCfg().m_ShowEventCounters ) + { + // Stop the timer during destruction early to avoid potential event race conditions (that do happen on windows) + m_eventCounterTimer->Stop(); + delete m_eventCounterTimer; + } + // Close modeless dialogs wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );