From 8b21a0a53de7be645c613bfb01d38e839cf4258f Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 4 Apr 2018 09:27:51 +0200 Subject: [PATCH] Changed PCB_BASE_FRAME::CreateNewModule() to stop adding modules to the board When a new footprint is created, CreateNewModule() added it to a dummy board in the footprint editor. If a footprint was indeed created (the action has not been aborted) then the dummy board was cleared, destroying the just created footprint. Also, the new footprint is later added with AddModuleToBoard() call. Fixes: lp:1761052 * https://bugs.launchpad.net/kicad/+bug/1761052 --- pcbnew/footprint_libraries_utils.cpp | 2 -- pcbnew/microwave.cpp | 1 + pcbnew/microwave/microwave_inductor.cpp | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index f1b4d2903d..137943be7b 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -830,8 +830,6 @@ MODULE* PCB_BASE_FRAME::CreateNewModule( const wxString& aModuleName ) // Creates the new module and add it to the head of the linked list of modules MODULE* module = new MODULE( GetBoard() ); - GetBoard()->Add( module ); - // Update parameters: timestamp ... module->SetLastEditTime(); diff --git a/pcbnew/microwave.cpp b/pcbnew/microwave.cpp index 5ad0ced945..fe39ff40fa 100644 --- a/pcbnew/microwave.cpp +++ b/pcbnew/microwave.cpp @@ -187,6 +187,7 @@ MODULE* PCB_EDIT_FRAME::CreateMuWaveBaseFootprint( const wxString& aValue, int aTextSize, int aPadCount ) { MODULE* module = CreateNewModule( aValue ); + AddModuleToBoard( module ); if( aTextSize > 0 ) { diff --git a/pcbnew/microwave/microwave_inductor.cpp b/pcbnew/microwave/microwave_inductor.cpp index 9e0e1edac2..90f399fec8 100644 --- a/pcbnew/microwave/microwave_inductor.cpp +++ b/pcbnew/microwave/microwave_inductor.cpp @@ -343,8 +343,8 @@ MODULE* MWAVE::CreateMicrowaveInductor( INDUCTOR_PATTERN& inductorPattern, return nullptr; // Aborted by user MODULE* module = aPcbFrame->CreateNewModule( msg ); + aPcbFrame->AddModuleToBoard( module ); - // here the module is already in the BOARD, CreateNewModule() does that. module->SetFPID( LIB_ID( wxString( "mw_inductor" ) ) ); module->SetAttributes( MOD_VIRTUAL | MOD_CMS ); module->ClearFlags();