Clear the playerFrame lookup cache when closing frames.
WindowIds aren't actually guaranteed to be unique, and we don't perform a dynamic_cast on the result of FindWindowById() because of linker issues.... This is an attempt to fix KICAD-39. Fixes https://gitlab.com/kicad/code/kicad/-/issues/14928
This commit is contained in:
parent
eaf65f7d53
commit
d6aefc458c
|
@ -506,7 +506,7 @@ bool KIWAY::PlayerClose( FRAME_T aFrameType, bool doForce )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
KIWAY_PLAYER* frame = GetPlayerFrame( aFrameType );
|
KIWAY_PLAYER* frame = GetPlayerFrame( aFrameType );
|
||||||
|
|
||||||
if( frame == nullptr ) // Already closed
|
if( frame == nullptr ) // Already closed
|
||||||
return true;
|
return true;
|
||||||
|
@ -538,14 +538,18 @@ bool KIWAY::PlayersClose( bool doForce )
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
|
||||||
for( unsigned i=0; i < KIWAY_PLAYER_COUNT; ++i )
|
for( unsigned i=0; i < KIWAY_PLAYER_COUNT; ++i )
|
||||||
{
|
|
||||||
ret = ret && PlayerClose( FRAME_T( i ), doForce );
|
ret = ret && PlayerClose( FRAME_T( i ), doForce );
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KIWAY::PlayerDidClose( FRAME_T aFrameType )
|
||||||
|
{
|
||||||
|
m_playerFrameId[aFrameType] = wxID_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void KIWAY::ExpressMail( FRAME_T aDestination, MAIL_T aCommand, std::string& aPayload,
|
void KIWAY::ExpressMail( FRAME_T aDestination, MAIL_T aCommand, std::string& aPayload,
|
||||||
wxWindow* aSource )
|
wxWindow* aSource )
|
||||||
{
|
{
|
||||||
|
|
|
@ -170,6 +170,8 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow
|
||||||
|
|
||||||
bool KIWAY_PLAYER::Destroy()
|
bool KIWAY_PLAYER::Destroy()
|
||||||
{
|
{
|
||||||
|
Kiway().PlayerDidClose( GetFrameType() );
|
||||||
|
|
||||||
return EDA_BASE_FRAME::Destroy();
|
return EDA_BASE_FRAME::Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -358,6 +358,11 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual bool PlayersClose( bool doForce );
|
virtual bool PlayersClose( bool doForce );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies a Kiway that a player has been closed.
|
||||||
|
*/
|
||||||
|
void PlayerDidClose( FRAME_T aFrameType );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send @a aPayload to @a aDestination from @a aSource.
|
* Send @a aPayload to @a aDestination from @a aSource.
|
||||||
*
|
*
|
||||||
|
@ -434,11 +439,6 @@ private:
|
||||||
/// Get the [path &] name of the DSO holding the requested FACE_T.
|
/// Get the [path &] name of the DSO holding the requested FACE_T.
|
||||||
const wxString dso_search_path( FACE_T aFaceId );
|
const wxString dso_search_path( FACE_T aFaceId );
|
||||||
|
|
||||||
#if 0
|
|
||||||
/// hooked into m_top in SetTop(), marks child frame as closed.
|
|
||||||
void player_destroy_handler( wxWindowDestroyEvent& event );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool set_kiface( FACE_T aFaceType, KIFACE* aKiface )
|
bool set_kiface( FACE_T aFaceType, KIFACE* aKiface )
|
||||||
{
|
{
|
||||||
if( (unsigned) aFaceType < (unsigned) KIWAY_FACE_COUNT )
|
if( (unsigned) aFaceType < (unsigned) KIWAY_FACE_COUNT )
|
||||||
|
|
Loading…
Reference in New Issue