Ensure the socket server is killed during destruction of the kiway player

(cherry picked from commit 8ae48bb093)
This commit is contained in:
Marek Roszko 2022-09-28 21:37:19 -04:00 committed by Mark Roszko
parent 8cbfd8af9f
commit 03ed7a4a27
1 changed files with 14 additions and 1 deletions

View File

@ -31,6 +31,7 @@
#include <typeinfo>
#include <wx/utils.h>
#include <wx/evtloop.h>
#include <wx/socket.h>
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 )