Fix double-click in footprint chooser.

Also fixes the assert when closing the chooser after the 3D
view was shown.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18107

(cherry picked from commit a3f69046ba)
This commit is contained in:
Jeff Young
2024-12-20 11:23:45 +00:00
parent 162c7f7d8c
commit bbd2d75a62
3 changed files with 18 additions and 4 deletions
+3 -2
View File
@@ -216,6 +216,8 @@ public:
*/
void DoRePaint();
void OnCloseWindow( wxCloseEvent& event );
private:
// The wxPaintEvent event. mainly calls DoRePaint()
void OnPaint( wxPaintEvent& aEvent );
@@ -226,14 +228,13 @@ private:
void OnMouseWheel( wxMouseEvent& event );
void OnMagnify( wxMouseEvent& event );
void OnMagnify( wxMouseEvent& event );
void OnMouseMove( wxMouseEvent& event );
void OnLeftDown( wxMouseEvent& event );
void OnLeftUp( wxMouseEvent& event );
void OnMiddleUp( wxMouseEvent& event );
void OnMiddleDown( wxMouseEvent& event );
void OnTimerTimeout_Editing( wxTimerEvent& event );
void OnCloseWindow( wxCloseEvent& event );
void OnResize( wxSizeEvent& event );
void OnTimerTimeout_Redraw( wxTimerEvent& event );
+10 -2
View File
@@ -62,12 +62,12 @@ DIALOG_FOOTPRINT_CHOOSER::DIALOG_FOOTPRINT_CHOOSER( PCB_BASE_FRAME* aParent,
// Accept handler
[this]()
{
EndModal( wxID_OK );
EndQuasiModal( wxID_OK );
},
// Escape handler
[this]()
{
EndModal( wxID_CANCEL );
EndQuasiModal( wxID_CANCEL );
} );
m_SizerTop->Add( m_chooserPanel, 1, wxEXPAND | wxRIGHT, 5 );
@@ -292,4 +292,12 @@ void DIALOG_FOOTPRINT_CHOOSER::TearDownQuasiModal()
}
}
}
if( m_preview3DCanvas )
{
// Work around assertion firing when we try to LockCtx on a hidden 3D canvas during dtor
wxCloseEvent dummy;
m_preview3DCanvas->Show();
m_preview3DCanvas->OnCloseWindow( dummy );
}
}
+5
View File
@@ -213,6 +213,11 @@ FOOTPRINT_CHOOSER_FRAME::FOOTPRINT_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aPare
FOOTPRINT_CHOOSER_FRAME::~FOOTPRINT_CHOOSER_FRAME()
{
// Work around assertion firing when we try to LockCtx on a hidden 3D canvas during dtor
wxCloseEvent dummy;
m_preview3DCanvas->Show();
m_preview3DCanvas->OnCloseWindow( dummy );
// Disconnect Events
m_grButton3DView->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler( FOOTPRINT_CHOOSER_FRAME::on3DviewReq ), NULL, this );