diff --git a/pcbnew/dialogs/dialog_cleanup_graphics_base.cpp b/pcbnew/dialogs/dialog_cleanup_graphics_base.cpp
index cd501b9a0c..c29d4b59ee 100644
--- a/pcbnew/dialogs/dialog_cleanup_graphics_base.cpp
+++ b/pcbnew/dialogs/dialog_cleanup_graphics_base.cpp
@@ -62,6 +62,7 @@ DIALOG_CLEANUP_GRAPHICS_BASE::DIALOG_CLEANUP_GRAPHICS_BASE( wxWindow* parent, wx
// Connect Events
m_createRectanglesOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_GRAPHICS_BASE::OnCheckBox ), NULL, this );
+ m_deleteRedundantOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_GRAPHICS_BASE::OnCheckBox ), NULL, this );
m_changesDataView->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_CLEANUP_GRAPHICS_BASE::OnSelectItem ), NULL, this );
m_changesDataView->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_CLEANUP_GRAPHICS_BASE::OnLeftDClickItem ), NULL, this );
}
@@ -70,6 +71,7 @@ DIALOG_CLEANUP_GRAPHICS_BASE::~DIALOG_CLEANUP_GRAPHICS_BASE()
{
// Disconnect Events
m_createRectanglesOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_GRAPHICS_BASE::OnCheckBox ), NULL, this );
+ m_deleteRedundantOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_GRAPHICS_BASE::OnCheckBox ), NULL, this );
m_changesDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_CLEANUP_GRAPHICS_BASE::OnSelectItem ), NULL, this );
m_changesDataView->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_CLEANUP_GRAPHICS_BASE::OnLeftDClickItem ), NULL, this );
diff --git a/pcbnew/dialogs/dialog_cleanup_graphics_base.fbp b/pcbnew/dialogs/dialog_cleanup_graphics_base.fbp
index 2d58c0a783..6e51c93d42 100644
--- a/pcbnew/dialogs/dialog_cleanup_graphics_base.fbp
+++ b/pcbnew/dialogs/dialog_cleanup_graphics_base.fbp
@@ -194,6 +194,7 @@
+ OnCheckBox
diff --git a/pcbnew/graphics_cleaner.cpp b/pcbnew/graphics_cleaner.cpp
index 9dcd8f268d..348e77b6fe 100644
--- a/pcbnew/graphics_cleaner.cpp
+++ b/pcbnew/graphics_cleaner.cpp
@@ -150,7 +150,7 @@ void GRAPHICS_CLEANER::cleanupSegments()
m_itemsList->push_back( item );
if( !m_dryRun )
- m_commit.Removed( segment );
+ m_commit.Remove( segment );
continue;
}
@@ -171,7 +171,7 @@ void GRAPHICS_CLEANER::cleanupSegments()
segment2->SetFlags( IS_DELETED );
if( !m_dryRun )
- m_commit.Removed( segment2 );
+ m_commit.Remove( segment2 );
}
}
}
@@ -204,7 +204,7 @@ void GRAPHICS_CLEANER::mergeRects()
{
PCB_SHAPE* shape = dynamic_cast( item );
- if( !shape || shape->GetShape() != SHAPE_T::SEGMENT )
+ if( !shape || isNullShape( shape ) || shape->GetShape() != SHAPE_T::SEGMENT )
continue;
if( shape->GetStart().x == shape->GetEnd().x || shape->GetStart().y == shape->GetEnd().y )
@@ -269,7 +269,7 @@ void GRAPHICS_CLEANER::mergeRects()
//
for( SIDE_CANDIDATE* candidate : ptMap[ top->end ] )
{
- if( candidate != top && viable( candidate ) )
+ if( candidate != top && candidate != left && viable( candidate ) )
{
right = candidate;
break;
@@ -278,7 +278,7 @@ void GRAPHICS_CLEANER::mergeRects()
for( SIDE_CANDIDATE* candidate : ptMap[ left->end ] )
{
- if( candidate != left && viable( candidate ) )
+ if( candidate != top && candidate != left && viable( candidate ) )
{
bottom = candidate;
break;