From a0940b10d4aaadb8a2eea48416f2e25d03b7e5a5 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 18 Aug 2025 21:45:44 +0100 Subject: [PATCH] Always provide a SCH_SCREEN to SCH_COMMIT. Fixes KICAD-YKY --- eeschema/api/api_handler_sch.cpp | 4 ++-- eeschema/dialogs/dialog_update_symbol_fields.cpp | 2 +- eeschema/sch_commit.cpp | 4 ++-- eeschema/sch_design_block_utils.cpp | 2 +- eeschema/tools/sch_find_replace_tool.cpp | 4 +++- eeschema/tools/sch_point_editor.cpp | 8 +++----- eeschema/tools/symbol_editor_edit_tool.cpp | 4 ++-- eeschema/tools/symbol_editor_pin_tool.cpp | 4 ++-- include/tool/edit_table_tool_base.h | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eeschema/api/api_handler_sch.cpp b/eeschema/api/api_handler_sch.cpp index 44b68990fe..90b6e998ea 100644 --- a/eeschema/api/api_handler_sch.cpp +++ b/eeschema/api/api_handler_sch.cpp @@ -253,7 +253,7 @@ HANDLER_RESULT API_HANDLER_SCH::handleCreateUpdateItemsIntern if( aCreate ) { item->Serialize( newItem ); - commit->Add( item.release() ); + commit->Add( item.release(), screen ); if( !m_activeClients.count( aClientName ) ) pushCurrentCommit( aClientName, _( "Added items via API" ) ); @@ -266,7 +266,7 @@ HANDLER_RESULT API_HANDLER_SCH::handleCreateUpdateItemsIntern { schItem->SwapItemData( static_cast( item.get() ) ); schItem->Serialize( newItem ); - commit->Modify( schItem ); + commit->Modify( schItem, screen ); } else { diff --git a/eeschema/dialogs/dialog_update_symbol_fields.cpp b/eeschema/dialogs/dialog_update_symbol_fields.cpp index 53808b5be7..7ee6e43b20 100644 --- a/eeschema/dialogs/dialog_update_symbol_fields.cpp +++ b/eeschema/dialogs/dialog_update_symbol_fields.cpp @@ -123,7 +123,7 @@ void DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked( wxCommandEvent& aEvent ) wxBusyCursor dummy; SCH_COMMIT commit( m_editFrame ); - commit.Modify( m_symbol ); + commit.Modify( m_symbol, m_editFrame->GetScreen() ); // Create the set of fields to be updated m_updateFields.clear(); diff --git a/eeschema/sch_commit.cpp b/eeschema/sch_commit.cpp index a48372ad5f..3dfacf1901 100644 --- a/eeschema/sch_commit.cpp +++ b/eeschema/sch_commit.cpp @@ -198,7 +198,7 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags ) // We don't know that anything will be added to the entered group, but it does no harm to // add it to the commit anyway. if( enteredGroup ) - Modify( enteredGroup ); + Modify( enteredGroup, frame->GetScreen() ); // Handle wires with Hop Over shapes: for( COMMIT_LINE& entry : m_entries ) @@ -222,7 +222,7 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags ) wxCHECK2( schItem, continue ); if( changeType == CHT_REMOVE && schItem->GetParentGroup() ) - Modify( schItem->GetParentGroup()->AsEdaItem() ); + Modify( schItem->GetParentGroup()->AsEdaItem(), entry.m_screen ); } for( COMMIT_LINE& entry : m_entries ) diff --git a/eeschema/sch_design_block_utils.cpp b/eeschema/sch_design_block_utils.cpp index 79a7483ab2..dd3fc4f96f 100644 --- a/eeschema/sch_design_block_utils.cpp +++ b/eeschema/sch_design_block_utils.cpp @@ -471,7 +471,7 @@ bool SCH_EDIT_FRAME::SaveSelectionToDesignBlock( const LIB_ID& aLibId ) { SCH_COMMIT commit( m_toolManager ); - commit.Modify( group ); + commit.Modify( group, GetScreen() ); group->SetDesignBlockLibId( aLibId ); commit.Push( "Set Group Design Block Link" ); diff --git a/eeschema/tools/sch_find_replace_tool.cpp b/eeschema/tools/sch_find_replace_tool.cpp index 0a61c106c2..b36a1f3379 100644 --- a/eeschema/tools/sch_find_replace_tool.cpp +++ b/eeschema/tools/sch_find_replace_tool.cpp @@ -447,7 +447,9 @@ int SCH_FIND_REPLACE_TOOL::ReplaceAll( const TOOL_EVENT& aEvent ) auto doReplace = [&]( SCH_ITEM* aItem, SCH_SHEET_PATH* aSheet, EDA_SEARCH_DATA& aData ) { - commit.Modify( aItem, aSheet ? aSheet->LastScreen() : nullptr, RECURSE_MODE::NO_RECURSE ); + wxCHECK_RET( aSheet, wxT( "must have a sheetpath for undo" ) ); + + commit.Modify( aItem, aSheet->LastScreen(), RECURSE_MODE::NO_RECURSE ); if( aItem->Replace( aData, aSheet ) ) { diff --git a/eeschema/tools/sch_point_editor.cpp b/eeschema/tools/sch_point_editor.cpp index 5a89f97f3c..e3a06bdc2b 100644 --- a/eeschema/tools/sch_point_editor.cpp +++ b/eeschema/tools/sch_point_editor.cpp @@ -616,8 +616,7 @@ public: private: void dragPinsOnEdge( const std::vector& aOldEdges, const std::vector& aMoveVecs, - int aEdgeUnit, COMMIT& aCommit, - std::vector& aUpdatedItems ) const + int aEdgeUnit, COMMIT& aCommit, std::vector& aUpdatedItems ) const { wxCHECK( aOldEdges.size() == aMoveVecs.size(), /* void */ ); @@ -668,12 +667,11 @@ private: if( aMoveVecs[i] == VECTOR2I( 0, 0 ) || !symbol ) continue; - const std::vector pins = getPinsOnSeg( *symbol, aEdgeUnit, aOldEdges[i], - false ); + const std::vector pins = getPinsOnSeg( *symbol, aEdgeUnit, aOldEdges[i], false ); for( SCH_PIN* pin : pins ) { - aCommit.Modify( pin ); + aCommit.Modify( pin, editor.GetScreen() ); aUpdatedItems.push_back( pin ); // Move the pin diff --git a/eeschema/tools/symbol_editor_edit_tool.cpp b/eeschema/tools/symbol_editor_edit_tool.cpp index c653c045ba..5945958673 100644 --- a/eeschema/tools/symbol_editor_edit_tool.cpp +++ b/eeschema/tools/symbol_editor_edit_tool.cpp @@ -688,7 +688,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent ) if( !symbol ) return 0; - commit.Modify( symbol ); + commit.Modify( symbol, m_frame->GetScreen() ); SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool(); wxCHECK( selTool, -1 ); @@ -920,7 +920,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent ) SCH_COMMIT commit( m_toolMgr ); - commit.Modify( symbol ); + commit.Modify( symbol, m_frame->GetScreen() ); m_selectionTool->ClearSelection(); for( SCH_ITEM& item : symbol->GetDrawItems() ) diff --git a/eeschema/tools/symbol_editor_pin_tool.cpp b/eeschema/tools/symbol_editor_pin_tool.cpp index 99c58725ed..fca02605c1 100644 --- a/eeschema/tools/symbol_editor_pin_tool.cpp +++ b/eeschema/tools/symbol_editor_pin_tool.cpp @@ -123,7 +123,7 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( SCH_PIN* aPin, bool aFocusPinNum LIB_SYMBOL* parentSymbol = static_cast( aPin->GetParentSymbol() ); if( aPin->GetEditFlags() == 0 ) - commit.Modify( parentSymbol ); + commit.Modify( parentSymbol, m_frame->GetScreen() ); if( dlg.ShowModal() == wxID_CANCEL ) return false; @@ -415,7 +415,7 @@ SCH_PIN* SYMBOL_EDITOR_PIN_TOOL::RepeatPin( const SCH_PIN* aSourcePin ) SCH_COMMIT commit( m_frame ); LIB_SYMBOL* symbol = m_frame->GetCurSymbol(); - commit.Modify( symbol ); + commit.Modify( symbol, m_frame->GetScreen() ); SCH_PIN* pin = static_cast( aSourcePin->Duplicate( true, &commit ) ); diff --git a/include/tool/edit_table_tool_base.h b/include/tool/edit_table_tool_base.h index cef84f88bc..d020df6dcf 100644 --- a/include/tool/edit_table_tool_base.h +++ b/include/tool/edit_table_tool_base.h @@ -363,7 +363,7 @@ protected: if( deleted.size() == (unsigned) table->GetRowCount() ) { - commit.Remove( table ); + commit.Remove( table, getScreen() ); } else { @@ -440,7 +440,7 @@ protected: if( deleted.size() == (unsigned) table->GetColCount() ) { - commit.Remove( table ); + commit.Remove( table, getScreen() ); } else {