Always provide a SCH_SCREEN to SCH_COMMIT.

Fixes KICAD-YKY
This commit is contained in:
Jeff Young 2025-08-18 21:45:44 +01:00
parent c51d26e70a
commit a0940b10d4
9 changed files with 18 additions and 18 deletions

View File

@ -253,7 +253,7 @@ HANDLER_RESULT<ItemRequestStatus> API_HANDLER_SCH::handleCreateUpdateItemsIntern
if( aCreate ) if( aCreate )
{ {
item->Serialize( newItem ); item->Serialize( newItem );
commit->Add( item.release() ); commit->Add( item.release(), screen );
if( !m_activeClients.count( aClientName ) ) if( !m_activeClients.count( aClientName ) )
pushCurrentCommit( aClientName, _( "Added items via API" ) ); pushCurrentCommit( aClientName, _( "Added items via API" ) );
@ -266,7 +266,7 @@ HANDLER_RESULT<ItemRequestStatus> API_HANDLER_SCH::handleCreateUpdateItemsIntern
{ {
schItem->SwapItemData( static_cast<SCH_ITEM*>( item.get() ) ); schItem->SwapItemData( static_cast<SCH_ITEM*>( item.get() ) );
schItem->Serialize( newItem ); schItem->Serialize( newItem );
commit->Modify( schItem ); commit->Modify( schItem, screen );
} }
else else
{ {

View File

@ -123,7 +123,7 @@ void DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked( wxCommandEvent& aEvent )
wxBusyCursor dummy; wxBusyCursor dummy;
SCH_COMMIT commit( m_editFrame ); SCH_COMMIT commit( m_editFrame );
commit.Modify( m_symbol ); commit.Modify( m_symbol, m_editFrame->GetScreen() );
// Create the set of fields to be updated // Create the set of fields to be updated
m_updateFields.clear(); m_updateFields.clear();

View File

@ -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 // 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. // add it to the commit anyway.
if( enteredGroup ) if( enteredGroup )
Modify( enteredGroup ); Modify( enteredGroup, frame->GetScreen() );
// Handle wires with Hop Over shapes: // Handle wires with Hop Over shapes:
for( COMMIT_LINE& entry : m_entries ) for( COMMIT_LINE& entry : m_entries )
@ -222,7 +222,7 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
wxCHECK2( schItem, continue ); wxCHECK2( schItem, continue );
if( changeType == CHT_REMOVE && schItem->GetParentGroup() ) if( changeType == CHT_REMOVE && schItem->GetParentGroup() )
Modify( schItem->GetParentGroup()->AsEdaItem() ); Modify( schItem->GetParentGroup()->AsEdaItem(), entry.m_screen );
} }
for( COMMIT_LINE& entry : m_entries ) for( COMMIT_LINE& entry : m_entries )

View File

@ -471,7 +471,7 @@ bool SCH_EDIT_FRAME::SaveSelectionToDesignBlock( const LIB_ID& aLibId )
{ {
SCH_COMMIT commit( m_toolManager ); SCH_COMMIT commit( m_toolManager );
commit.Modify( group ); commit.Modify( group, GetScreen() );
group->SetDesignBlockLibId( aLibId ); group->SetDesignBlockLibId( aLibId );
commit.Push( "Set Group Design Block Link" ); commit.Push( "Set Group Design Block Link" );

View File

@ -447,7 +447,9 @@ int SCH_FIND_REPLACE_TOOL::ReplaceAll( const TOOL_EVENT& aEvent )
auto doReplace = auto doReplace =
[&]( SCH_ITEM* aItem, SCH_SHEET_PATH* aSheet, EDA_SEARCH_DATA& aData ) [&]( 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 ) ) if( aItem->Replace( aData, aSheet ) )
{ {

View File

@ -616,8 +616,7 @@ public:
private: private:
void dragPinsOnEdge( const std::vector<SEG>& aOldEdges, const std::vector<VECTOR2I>& aMoveVecs, void dragPinsOnEdge( const std::vector<SEG>& aOldEdges, const std::vector<VECTOR2I>& aMoveVecs,
int aEdgeUnit, COMMIT& aCommit, int aEdgeUnit, COMMIT& aCommit, std::vector<EDA_ITEM*>& aUpdatedItems ) const
std::vector<EDA_ITEM*>& aUpdatedItems ) const
{ {
wxCHECK( aOldEdges.size() == aMoveVecs.size(), /* void */ ); wxCHECK( aOldEdges.size() == aMoveVecs.size(), /* void */ );
@ -668,12 +667,11 @@ private:
if( aMoveVecs[i] == VECTOR2I( 0, 0 ) || !symbol ) if( aMoveVecs[i] == VECTOR2I( 0, 0 ) || !symbol )
continue; continue;
const std::vector<SCH_PIN*> pins = getPinsOnSeg( *symbol, aEdgeUnit, aOldEdges[i], const std::vector<SCH_PIN*> pins = getPinsOnSeg( *symbol, aEdgeUnit, aOldEdges[i], false );
false );
for( SCH_PIN* pin : pins ) for( SCH_PIN* pin : pins )
{ {
aCommit.Modify( pin ); aCommit.Modify( pin, editor.GetScreen() );
aUpdatedItems.push_back( pin ); aUpdatedItems.push_back( pin );
// Move the pin // Move the pin

View File

@ -688,7 +688,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent )
if( !symbol ) if( !symbol )
return 0; return 0;
commit.Modify( symbol ); commit.Modify( symbol, m_frame->GetScreen() );
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>(); SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
wxCHECK( selTool, -1 ); wxCHECK( selTool, -1 );
@ -920,7 +920,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
SCH_COMMIT commit( m_toolMgr ); SCH_COMMIT commit( m_toolMgr );
commit.Modify( symbol ); commit.Modify( symbol, m_frame->GetScreen() );
m_selectionTool->ClearSelection(); m_selectionTool->ClearSelection();
for( SCH_ITEM& item : symbol->GetDrawItems() ) for( SCH_ITEM& item : symbol->GetDrawItems() )

View File

@ -123,7 +123,7 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( SCH_PIN* aPin, bool aFocusPinNum
LIB_SYMBOL* parentSymbol = static_cast<LIB_SYMBOL*>( aPin->GetParentSymbol() ); LIB_SYMBOL* parentSymbol = static_cast<LIB_SYMBOL*>( aPin->GetParentSymbol() );
if( aPin->GetEditFlags() == 0 ) if( aPin->GetEditFlags() == 0 )
commit.Modify( parentSymbol ); commit.Modify( parentSymbol, m_frame->GetScreen() );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return false; return false;
@ -415,7 +415,7 @@ SCH_PIN* SYMBOL_EDITOR_PIN_TOOL::RepeatPin( const SCH_PIN* aSourcePin )
SCH_COMMIT commit( m_frame ); SCH_COMMIT commit( m_frame );
LIB_SYMBOL* symbol = m_frame->GetCurSymbol(); LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
commit.Modify( symbol ); commit.Modify( symbol, m_frame->GetScreen() );
SCH_PIN* pin = static_cast<SCH_PIN*>( aSourcePin->Duplicate( true, &commit ) ); SCH_PIN* pin = static_cast<SCH_PIN*>( aSourcePin->Duplicate( true, &commit ) );

View File

@ -363,7 +363,7 @@ protected:
if( deleted.size() == (unsigned) table->GetRowCount() ) if( deleted.size() == (unsigned) table->GetRowCount() )
{ {
commit.Remove( table ); commit.Remove( table, getScreen() );
} }
else else
{ {
@ -440,7 +440,7 @@ protected:
if( deleted.size() == (unsigned) table->GetColCount() ) if( deleted.size() == (unsigned) table->GetColCount() )
{ {
commit.Remove( table ); commit.Remove( table, getScreen() );
} }
else else
{ {