Fix schematic editor crash when dragging symbols.

Do not set view items or update connectivity until after commit changes
are updated in the SCH_SREEN.  Updating the screen can force LIB_SYMBOL
changes which and lead to stale LIB_PIN object pointers stored in SCH_PIN
objects.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16846
This commit is contained in:
Wayne Stambaugh 2024-02-09 10:38:29 -05:00
parent 63fc89cafd
commit 3d690da305
1 changed files with 5 additions and 3 deletions

View File

@ -509,7 +509,6 @@ void SCH_COMMIT::Revert()
view->Remove( item );
item->SwapData( copy );
item->SetConnectivityDirty();
// Special cases for items which have instance data
if( item->GetParent() && item->GetParent()->Type() == SCH_SYMBOL_T
@ -525,11 +524,14 @@ void SCH_COMMIT::Revert()
}
}
// This must be called before any calls that require stable object pointers.
screen->Update( item );
item->SetConnectivityDirty();
if( view )
view->Add( item );
screen->Update( item );
delete copy;
break;
}