Fix a crash bug trying to update the view before it was ready.

This commit is contained in:
Jeff Young 2020-12-20 17:48:15 +00:00
parent dc1c80beb8
commit 7376c25ebe
3 changed files with 8 additions and 22 deletions

View File

@ -425,10 +425,11 @@ void DIALOG_ERC::testErc()
m_markerTreeModel->SetProvider( m_markerProvider );
// Display new markers from the current screen:
KIGFX::VIEW* view = m_parent->GetCanvas()->GetView();
for( auto item : m_parent->GetScreen()->Items().OfType( SCH_MARKER_T ) )
view->Add( item );
for( SCH_ITEM* marker : m_parent->GetScreen()->Items().OfType( SCH_MARKER_T ) )
{
m_parent->GetCanvas()->GetView()->Remove( marker );
m_parent->GetCanvas()->GetView()->Add( marker );
}
m_parent->GetCanvas()->Refresh();

View File

@ -725,18 +725,6 @@ void SCH_EDIT_FRAME::ResolveERCExclusions()
else
Schematic().RootScreen()->Append( marker );
}
// Update the view for the current screen
for( SCH_ITEM* item : GetScreen()->Items().OfType( SCH_MARKER_T ) )
{
SCH_MARKER* marker = static_cast<SCH_MARKER*>( item );
if( marker->IsExcluded() )
{
GetCanvas()->GetView()->Remove( marker );
GetCanvas()->GetView()->Add( marker );
}
}
}
@ -1277,7 +1265,7 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags )
timer.Stop();
wxLogTrace( "CONN_PROFILE", "SchematicCleanUp() %0.4f ms", timer.msecs() );
if( settings.m_IntersheetRefsShow == true )
if( settings.m_IntersheetRefsShow )
RecomputeIntersheetRefs();
std::function<void( SCH_ITEM* )> changeHandler =
@ -1290,7 +1278,7 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags )
}
int SCH_EDIT_FRAME::RecomputeIntersheetRefs()
void SCH_EDIT_FRAME::RecomputeIntersheetRefs()
{
std::map<wxString, std::set<wxString>>& pageRefsMap = Schematic().GetPageRefsMap();
@ -1339,9 +1327,6 @@ int SCH_EDIT_FRAME::RecomputeIntersheetRefs()
GetCanvas()->GetView()->Update( global );
}
}
GetCanvas()->Refresh();
return 0;
}

View File

@ -932,7 +932,7 @@ public:
* so that they are redrawn with up-to-date references.
* @return
*/
int RecomputeIntersheetRefs();
void RecomputeIntersheetRefs();
void ShowAllIntersheetRefs( bool aShow );