diff --git a/common/settings/settings_manager.cpp b/common/settings/settings_manager.cpp index 5843f7c640..ede063ba36 100644 --- a/common/settings/settings_manager.cpp +++ b/common/settings/settings_manager.cpp @@ -216,7 +216,11 @@ COLOR_SETTINGS* SETTINGS_MANAGER::loadColorSettingsByName( const wxString& aName auto cs = static_cast( RegisterSettings( new COLOR_SETTINGS( aName ) ) ); if( cs->GetFilename() != aName.ToStdString() ) + { + // wxLogTrace is actually a macro so these braces are needed to keep Coverity from + // worrying about dangline else clauses.... wxLogTrace( traceSettings, "Warning: stored filename is actually %s, ", cs->GetFilename() ); + } m_color_settings[aName] = cs; diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index f409587270..a82aeff949 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -100,7 +100,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a PICKED_ITEMS_LIST undoList; KIGFX::VIEW* view = m_toolMgr->GetView(); BOARD* board = (BOARD*) m_toolMgr->GetModel(); - PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) m_toolMgr->GetToolHolder(); + PCB_BASE_FRAME* frame = dynamic_cast( m_toolMgr->GetToolHolder() ); auto connectivity = board->GetConnectivity(); std::set savedModules; PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool(); @@ -138,7 +138,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a wxASSERT( ent.m_item->Type() == PCB_FOOTPRINT_T ); wxASSERT( ent.m_copy->Type() == PCB_FOOTPRINT_T ); - if( aCreateUndoEntry ) + if( aCreateUndoEntry && frame ) { ITEM_PICKER itemWrapper( nullptr, ent.m_item, UNDO_REDO::CHANGED ); itemWrapper.SetLink( ent.m_copy ); @@ -409,7 +409,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a } } - if( !m_isFootprintEditor && aCreateUndoEntry ) + if( !m_isFootprintEditor && aCreateUndoEntry && frame ) frame->SaveCopyInUndoList( undoList, UNDO_REDO::UNSPECIFIED ); m_toolMgr->PostEvent( { TC_MESSAGE, TA_MODEL_CHANGE, AS_GLOBAL } ); @@ -417,10 +417,13 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a if( itemsDeselected ) m_toolMgr->PostEvent( EVENTS::UnselectedEvent ); - if( aSetDirtyBit ) - frame->OnModify(); - else if( frame ) - frame->Update3DView( true, frame->GetDisplayOptions().m_Live3DRefresh ); + if( frame ) + { + if( aSetDirtyBit ) + frame->OnModify(); + else + frame->Update3DView( true, frame->GetDisplayOptions().m_Live3DRefresh ); + } clear(); }