Fix crash in wxSocketBase when the event handler has been destroyed.
Fixes KICAD-37B Fixes https://gitlab.com/kicad/code/kicad/-/issues/18234
This commit is contained in:
parent
e1ffd956e6
commit
ebdfeb4c0a
|
@ -57,7 +57,6 @@ KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType
|
|||
|
||||
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
|
||||
|
@ -69,6 +68,20 @@ KIWAY_PLAYER::~KIWAY_PLAYER() throw()
|
|||
delete m_socketServer;
|
||||
m_socketServer = nullptr;
|
||||
}
|
||||
|
||||
// remove active sockets as well
|
||||
for( wxSocketBase* socket : m_sockets )
|
||||
{
|
||||
if( !socket )
|
||||
continue;
|
||||
|
||||
// ensure any event handling stops
|
||||
socket->Notify( false );
|
||||
|
||||
delete socket;
|
||||
}
|
||||
|
||||
m_sockets.clear();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue