From 3d690da30511d92619219d18b6154ef57cb4d5de Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Fri, 9 Feb 2024 10:38:29 -0500 Subject: [PATCH] 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 --- eeschema/sch_commit.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/eeschema/sch_commit.cpp b/eeschema/sch_commit.cpp index d7d485f4cc..21c1bb0307 100644 --- a/eeschema/sch_commit.cpp +++ b/eeschema/sch_commit.cpp @@ -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; }