Make sure 3D file browser is treated as modal by quit.

(Otherwise we crash when freeing it during the quit.)

(cherry picked from commit c36b0fcda7)
This commit is contained in:
Jeff Young 2023-05-30 14:40:16 +01:00
parent 117c70ed7d
commit 0bd45f691e
2 changed files with 21 additions and 8 deletions

View File

@ -167,15 +167,28 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, const wxS
}
wxWindow* findQuasiModalDialog( wxWindow* aParent )
{
for( wxWindow* child : aParent->GetChildren() )
{
if( DIALOG_SHIM* dlg = dynamic_cast<DIALOG_SHIM*>( child ) )
{
if( dlg->IsQuasiModal() )
return dlg;
if( wxWindow* nestedDlg = findQuasiModalDialog( child ) )
return nestedDlg;
}
}
return nullptr;
}
wxWindow* EDA_BASE_FRAME::findQuasiModalDialog()
{
for( wxWindow* iter : GetChildren() )
{
DIALOG_SHIM* dlg = dynamic_cast<DIALOG_SHIM*>( iter );
if( dlg && dlg->IsQuasiModal() )
return dlg;
}
if( wxWindow* dlg = ::findQuasiModalDialog( this ) )
return dlg;
// FIXME: CvPcb is currently implemented on top of KIWAY_PLAYER rather than DIALOG_SHIM,
// so we have to look for it separately.

View File

@ -308,7 +308,7 @@ void PANEL_FP_PROPERTIES_3D_MODEL::OnAdd3DModel( wxCommandEvent& )
filter = (int) tmp;
}
if( !S3D::Select3DModel( this, m_frame->Prj().Get3DCacheManager(), initialpath, filter, &model )
if( !S3D::Select3DModel( m_parentDialog, m_frame->Prj().Get3DCacheManager(), initialpath, filter, &model )
|| model.m_Filename.empty() )
{
select3DModel( selected );