From 05f849a746564981456e990c61f05d50b8022c87 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 5 Jul 2016 17:01:41 +0200 Subject: [PATCH] Pcbnew: fix potential issue (crash) when loading board files with a missing net section (like created by Gerbview) due to an initialization made to late. --- pcbnew/files.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index e7202700d5..29d6a74ee3 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -570,8 +570,17 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in // Rebuild the new pad list (for drc and ratsnet control ...) GetBoard()->m_Status_Pcb = 0; - // Update info shown by the horizontal toolbars + // Update current netclass:NETCLASS::Default alwaysxists SetCurrentNetClass( NETCLASS::Default ); + + // Rebuild list of nets (full ratsnest rebuild) + { + wxBusyCursor dummy; // Displays an Hourglass while building connectivity + Compile_Ratsnest( NULL, true ); + GetBoard()->GetRatsnest()->ProcessBoard(); + } + + // Update info shown by the horizontal toolbars ReFillLayerWidget(); ReCreateLayerBox(); @@ -591,13 +600,6 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in // Display the loaded board: Zoom_Automatique( false ); - // Compile ratsnest and displays net info - { - wxBusyCursor dummy; // Displays an Hourglass while building connectivity - Compile_Ratsnest( NULL, true ); - GetBoard()->GetRatsnest()->ProcessBoard(); - } - SetMsgPanel( GetBoard() ); // Refresh the 3D view, if any