diff --git a/common/widgets/footprint_preview_widget.cpp b/common/widgets/footprint_preview_widget.cpp index 2b0f882501..c736f31718 100644 --- a/common/widgets/footprint_preview_widget.cpp +++ b/common/widgets/footprint_preview_widget.cpp @@ -135,21 +135,16 @@ void FOOTPRINT_PREVIEW_WIDGET::RefreshAll() FOOTPRINT_PREVIEW_PANEL_BASE* FOOTPRINT_PREVIEW_PANEL_BASE::Create( wxWindow* aParent, KIWAY& aKiway ) { - FOOTPRINT_PREVIEW_PANEL_BASE* panel = nullptr; + wxWindow* panel = nullptr; try { - KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB ); - wxWindow* window = kiface->CreateKiWindow( aParent, FRAME_FOOTPRINT_PREVIEW, &aKiway ); - - panel = dynamic_cast( window ); - - if( window && !panel ) - delete window; + if( KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB ) ) + panel = kiface->CreateKiWindow( aParent, FRAME_FOOTPRINT_PREVIEW, &aKiway ); } catch( ... ) { } - return panel; + return (FOOTPRINT_PREVIEW_PANEL_BASE*) panel; } diff --git a/pcbnew/project_pcb.cpp b/pcbnew/project_pcb.cpp index 78a5885601..3d3ec74e96 100644 --- a/pcbnew/project_pcb.cpp +++ b/pcbnew/project_pcb.cpp @@ -79,7 +79,7 @@ S3D_CACHE* PROJECT_PCB::Get3DCacheManager( PROJECT* aProject, bool aUpdateProjDi std::lock_guard lock( mutex3D_cacheManager ); // Get the existing cache from the project - S3D_CACHE* cache = dynamic_cast( aProject->GetElem( PROJECT::ELEM::S3DCACHE ) ); + S3D_CACHE* cache = static_cast( aProject->GetElem( PROJECT::ELEM::S3DCACHE ) ); if( !cache ) { @@ -115,7 +115,7 @@ void PROJECT_PCB::Cleanup3DCache( PROJECT* aProject ) std::lock_guard lock( mutex3D_cacheManager ); // Get the existing cache from the project - S3D_CACHE* cache = dynamic_cast( aProject->GetElem( PROJECT::ELEM::S3DCACHE ) ); + S3D_CACHE* cache = static_cast( aProject->GetElem( PROJECT::ELEM::S3DCACHE ) ); if( cache ) {