From 03ed7a4a270426a6a5d6856e15b4969fd8524030 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Wed, 28 Sep 2022 21:37:19 -0400 Subject: [PATCH] Ensure the socket server is killed during destruction of the kiway player (cherry picked from commit 8ae48bb0933dfd372a181e3dbc669650550a10e8) --- common/kiway_player.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/common/kiway_player.cpp b/common/kiway_player.cpp index e7bccfad83..76348aa0ea 100644 --- a/common/kiway_player.cpp +++ b/common/kiway_player.cpp @@ -31,6 +31,7 @@ #include #include #include +#include BEGIN_EVENT_TABLE( KIWAY_PLAYER, EDA_BASE_FRAME ) @@ -65,7 +66,19 @@ KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& a } -KIWAY_PLAYER::~KIWAY_PLAYER() throw() {} +KIWAY_PLAYER::~KIWAY_PLAYER() throw() { + + // socket server must be destructed before we complete + // destructing the frame or else we could crash + // as the socket server holds a reference to this frame + if( m_socketServer ) + { + // ensure any event handling stops + m_socketServer->Notify( false ); + + delete m_socketServer; + } +} void KIWAY_PLAYER::KiwayMailIn( KIWAY_EXPRESS& aEvent )