Pcbnew: fix crash when undoing a move exact pad in board editor.

Fix also very minor warnings detected by cppcheck.
This commit is contained in:
jean-pierre charras 2015-02-22 10:39:58 +01:00
parent 014905e7db
commit c1978b3242
10 changed files with 22 additions and 19 deletions

View File

@ -35,9 +35,9 @@
// Conversion to application internal units defined at build time.
#if defined( PCBNEW )
#include <class_board_item.h>
#include <class_board_item.h> // for FMT_IU
#elif defined( EESCHEMA )
#include <sch_item_struct.h>
#include <sch_item_struct.h> // for FMT_IU
#elif defined( GERBVIEW )
#elif defined( PL_EDITOR )
#include <base_units.h>

View File

@ -132,7 +132,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
bool valExist = false;
// try to find component in existing list
for( iter = list.begin(); iter != list.end(); iter++ )
for( iter = list.begin(); iter != list.end(); ++iter )
{
cmp* current = *iter;

View File

@ -242,7 +242,7 @@ int BOARD_DESIGN_SETTINGS::GetBiggestClearanceValue()
int clearance = m_NetClasses.GetDefault()->GetClearance();
//Read list of Net Classes
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); nc++ )
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); ++nc )
{
NETCLASSPTR netclass = nc->second;
clearance = std::max( clearance, netclass->GetClearance() );
@ -257,7 +257,7 @@ int BOARD_DESIGN_SETTINGS::GetSmallestClearanceValue()
int clearance = m_NetClasses.GetDefault()->GetClearance();
//Read list of Net Classes
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); nc++ )
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); ++nc )
{
NETCLASSPTR netclass = nc->second;
clearance = std::min( clearance, netclass->GetClearance() );

View File

@ -145,9 +145,7 @@ MODULE::MODULE( const MODULE& aModule ) :
if( item->GetShape3DName().IsEmpty() ) // do not copy empty shapes.
continue;
S3D_MASTER* t3d = m_3D_Drawings;
t3d = new S3D_MASTER( this );
S3D_MASTER* t3d = new S3D_MASTER( this );
t3d->Copy( item );
m_3D_Drawings.PushBack( t3d );
}

View File

@ -120,10 +120,10 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)frame->GetDisplayOptions();
PCB_SCREEN* screen = frame->GetScreen();
if( displ_opts->m_DisplayPadFill == FILLED )
drawInfo.m_ShowPadFilled = true;
else
if( displ_opts && displ_opts->m_DisplayPadFill == SKETCH )
drawInfo.m_ShowPadFilled = false;
else
drawInfo.m_ShowPadFilled = true;
EDA_COLOR_T color = BLACK;
if( m_layerMask[F_Cu] )

View File

@ -1516,8 +1516,14 @@ void PCB_EDIT_FRAME::moveExact()
{
BOARD_ITEM* item = GetScreen()->GetCurItem();
// When a pad is modified, the full footprint is saved
BOARD_ITEM* itemToSave = item;
if( item->Type() == PCB_PAD_T )
itemToSave = item->GetParent();
// Could be moved or rotated
SaveCopyInUndoList( item, UR_CHANGED );
SaveCopyInUndoList( itemToSave, UR_CHANGED );
item->Move( translation );
item->Rotate( item->GetPosition(), rotation );

View File

@ -361,9 +361,9 @@ bool EXCELLON_WRITER::GenDrillReportFile( const wxString& aFullFileName )
}
if( gen_NPTH_holes )
sprintf( line, "\nTotal unplated holes count %d\n\n\n", totalHoleCount );
sprintf( line, "\nTotal unplated holes count %u\n\n\n", totalHoleCount );
else
sprintf( line, "\nTotal plated holes count %d\n\n\n", totalHoleCount );
sprintf( line, "\nTotal plated holes count %u\n\n\n", totalHoleCount );
fputs( line, m_file );

View File

@ -91,8 +91,7 @@ void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumbe
GeneralControl( aDC, tPosition );
for( std::list<MACROS_RECORD>::iterator i = m_Macros[aNumber].m_Record.begin();
i != m_Macros[aNumber].m_Record.end();
i++ )
i != m_Macros[aNumber].m_Record.end(); ++i )
{
wxPoint tmpPos = GetNearestGridPosition( tPosition + i->m_Position );

View File

@ -447,7 +447,7 @@ void DXF2BRD_CONVERTER::addHeader( const DRW_Header* data )
{
std::map<std::string, DRW_Variant*>::const_iterator it;
for( it = data->vars.begin(); it != data->vars.end(); it++ )
for( it = data->vars.begin(); it != data->vars.end(); ++it )
{
std::string key = ( (*it).first ).c_str();

View File

@ -238,9 +238,9 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->AddSeparator();
msg = AddHotkeyName( HELP_UNDO, g_Board_Editor_Hokeys_Descr, HK_UNDO, IS_COMMENT );
m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), HELP_UNDO );
m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), msg );
msg = AddHotkeyName( HELP_REDO, g_Board_Editor_Hokeys_Descr, HK_REDO, IS_COMMENT );
m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), HELP_REDO );
m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), msg );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ),