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
This commit is contained in:
Maciej Suminski 2018-04-04 09:27:51 +02:00
parent 2e4f50f206
commit 8b21a0a53d
3 changed files with 2 additions and 3 deletions

View File

@ -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();

View File

@ -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 )
{

View File

@ -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();