← Back to team overview

kicad-developers team mailing list archive

Re: Track cleanup (broken or changed?)

 

On Tue, Sep 17, 2013 at 09:39:12PM +0200, Lorenzo Marcantonio wrote:
> That's a good news. Now need to find why doesn't work on by side:(

Found the problem. An ugly mixup of similar names and random memory
content. The issue is in the dialog option transfer code...

In DIALOG_CLEANING_OPTION_BASE the members variables for the options are
declarated (by the wxFormStuff, I presume). I take mergeSegments as an
example (the same is valid for the other two options). These are
declared and not initialized => random value taken.

In the derived DIALOG_CLEANING_OPTION the static members for the options
are declared (I presume the idea is for keeping the options between
invocations); this is m_mergeSegments. Initialized to true and shuttled
to the controls during dialog construction and from the controls by
GetOpts at various times, especially when clicking OK (side note: why in
the destructor? wouldn't this save the settings even on the cancel
flow?)

HOWEVER PCB_EDIT_FRAME::Clean_Pcb(), during configuration of the
TRACK_CLEANER uses the *instance* members, not the *class* one i.e. the
autogenerated uninitialized variables generated by wxForm. So, it works
on luck:P

I suggest this to fix it (more thinking is required for the GetOpts in destructor thingy)

=== modified file 'pcbnew/clean.cpp'
--- pcbnew/clean.cpp    2013-04-09 20:06:00 +0000
+++ pcbnew/clean.cpp    2013-09-17 20:18:18 +0000
@@ -117,9 +117,9 @@
 
     wxBusyCursor( dummy );
     TRACKS_CLEANER cleaner( GetBoard() );
-    cleaner.SetdeleteUnconnectedTracksOpt( dlg.deleteUnconnectedSegm );
-    cleaner.SetMergeSegmentsOpt( dlg.mergeSegments );
-    cleaner.SetCleanViasOpt( dlg.cleanVias );
+    cleaner.SetdeleteUnconnectedTracksOpt( dlg.m_deleteUnconnectedSegm );
+    cleaner.SetMergeSegmentsOpt( dlg.m_mergeSegments );
+    cleaner.SetCleanViasOpt( dlg.m_cleanVias );
 
     if( cleaner.CleanupBoard() )
     {

-- 
Lorenzo Marcantonio
Logos Srl


References