Eeschema: fix multiple symbol rescue bug caused by commit 54f066fe
.
Use the root symbol when comparing against the cached symbol when checking to see if a symbol changed. When the original symbol is a derived symbol, the test will always fail. Force a symbol link refresh on a rescue to prevent stale links from crashing the connection graph refresh when running the project rescue on demand. Force a symbol link refresh on project load to prevent stale links from symbol link changes from crashing the connection graph when the project rescue in invoked. Fixes kicad/code/kicad#3645
This commit is contained in:
parent
a130ed9968
commit
30da2b31ea
|
@ -388,7 +388,9 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
RescueSymbolLibTableProject( false );
|
RescueSymbolLibTableProject( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
schematic.UpdateSymbolLinks(); // Update all symbol library links for all sheets.
|
schematic.UpdateSymbolLinks( true ); // Update all symbol library links for all sheets.
|
||||||
|
g_ConnectionGraph->Reset();
|
||||||
|
RecalculateConnections( GLOBAL_CLEANUP );
|
||||||
SetScreen( g_CurrentSheet->LastScreen() );
|
SetScreen( g_CurrentSheet->LastScreen() );
|
||||||
|
|
||||||
// Migrate conflicting bus definitions
|
// Migrate conflicting bus definitions
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <sch_draw_panel.h>
|
#include <sch_draw_panel.h>
|
||||||
#include <class_library.h>
|
#include <class_library.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
|
#include <connection_graph.h>
|
||||||
#include <invoke_sch_dialog.h>
|
#include <invoke_sch_dialog.h>
|
||||||
#include <kiway.h>
|
#include <kiway.h>
|
||||||
#include <project_rescue.h>
|
#include <project_rescue.h>
|
||||||
|
@ -373,14 +374,35 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
|
||||||
// A new part name is found (a new group starts here).
|
// A new part name is found (a new group starts here).
|
||||||
// Search the symbol names candidates only once for this group:
|
// Search the symbol names candidates only once for this group:
|
||||||
old_part_id = part_id;
|
old_part_id = part_id;
|
||||||
|
|
||||||
|
// Get the library symbol from the cache library. It will be a flattened
|
||||||
|
// symbol by default (no inheritance).
|
||||||
cache_match = find_component( part_id.Format().wx_str(), aRescuer.GetPrj()->SchLibs(),
|
cache_match = find_component( part_id.Format().wx_str(), aRescuer.GetPrj()->SchLibs(),
|
||||||
true );
|
true );
|
||||||
|
|
||||||
|
// Get the library symbol from the symbol library table.
|
||||||
lib_match = SchGetLibPart( part_id, aRescuer.GetPrj()->SchSymbolLibTable() );
|
lib_match = SchGetLibPart( part_id, aRescuer.GetPrj()->SchSymbolLibTable() );
|
||||||
|
|
||||||
if( !cache_match && !lib_match )
|
if( !cache_match && !lib_match )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
PART_SPTR lib_match_parent;
|
||||||
|
|
||||||
|
// If it's a derive symbol, use the parent symbol to perform the pin test.
|
||||||
|
if( lib_match && lib_match->IsAlias() )
|
||||||
|
{
|
||||||
|
lib_match_parent = lib_match->GetParent().lock();
|
||||||
|
|
||||||
|
if( !lib_match_parent )
|
||||||
|
{
|
||||||
|
lib_match = nullptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lib_match = lib_match_parent.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Test whether there is a conflict or if the symbol can only be found in the cache.
|
// Test whether there is a conflict or if the symbol can only be found in the cache.
|
||||||
if( LIB_ID::HasIllegalChars( part_id.GetLibItemName(), LIB_ID::ID_SCH ) == -1 )
|
if( LIB_ID::HasIllegalChars( part_id.GetLibItemName(), LIB_ID::ID_SCH ) == -1 )
|
||||||
{
|
{
|
||||||
|
@ -535,6 +557,15 @@ bool SCH_EDIT_FRAME::rescueProject( RESCUER& aRescuer, bool aRunningOnDemand )
|
||||||
if( viewer )
|
if( viewer )
|
||||||
viewer->ReCreateListLib();
|
viewer->ReCreateListLib();
|
||||||
|
|
||||||
|
if( aRunningOnDemand )
|
||||||
|
{
|
||||||
|
SCH_SCREENS schematic;
|
||||||
|
|
||||||
|
schematic.UpdateSymbolLinks( true );
|
||||||
|
g_ConnectionGraph->Reset();
|
||||||
|
RecalculateConnections( GLOBAL_CLEANUP );
|
||||||
|
}
|
||||||
|
|
||||||
GetScreen()->ClearUndoORRedoList( GetScreen()->m_UndoList, 1 );
|
GetScreen()->ClearUndoORRedoList( GetScreen()->m_UndoList, 1 );
|
||||||
SyncView();
|
SyncView();
|
||||||
GetCanvas()->Refresh();
|
GetCanvas()->Refresh();
|
||||||
|
|
Loading…
Reference in New Issue