Commit eec9f1f4 authored by dickelbeck's avatar dickelbeck
Browse files

fixed track delete bug

parent 959919dd
Loading
Loading
Loading
Loading
+28 −12
Original line number Diff line number Diff line
@@ -4,7 +4,24 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with 
email address.

2007-Nov-032 UPDATE  Jean-Pierre Charras <jean-pierre.charras@inpg.fr>

2007-Nov-2 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
+ pcbnew
    fixed a crashing bug which happened if you "dragged" a module with 
    tracks.  Then deleted one of the pad connected tracks, then deleted the
    next track attached to the first one.  Memory was being corrupted because
    PcbGeneralLocate() and display was not being called on the 2nd track to
    be deleted because the m_Flags test:
        bool ItemFree = (GetCurItem()==0  || GetCurItem()->m_Flags==0);
    was returning false. Solution was to SetCurItem(NULL) after deleting a
    TRACK.  This makes sense, SetCurItem() is used for designating a "selected"
    item, and a deleted TRACK is not even in the BOARD anymore and should not
    be selected or selectable.  I think this bug may have been causing spurious
    crashes for the last couple of months.


2007-Nov-02 UPDATE  Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+all:
    solved: eeschema, pcbnew and cvpcb did not find libraries when they were
@@ -13,7 +30,6 @@ email address.
    already a path) 



2007-Nov-02 UPDATE   Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
+ pcbnew
@@ -53,7 +69,7 @@ email address.
    create commandframe.cpp to handle the command frame (which have the 4 "fast launch" buttons)


2007-Oct-31 UPDATE   Dick Hollenbeck <dickelbeck@yahoo.com>
2007-Oct-31 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
+ all
  * Added Doxygen configuration file, whose standard name is Doxyfile.  Output
@@ -1124,7 +1140,7 @@ email address.
    better hotkey.cpp (code cleaning and info messages)


2007-June-19 UPDATE   Dick Hollenbeck <dickelbeck@yahoo.com>
2007-June-19 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
+ pcbnew
    After locking a module with 'L', update the status window with the locked
@@ -1140,7 +1156,7 @@ email address.
    add install targets for resources and docs

    
2007-June-15 UPDATE   Dick Hollenbeck <dickelbeck@yahoo.com>
2007-June-15 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
+ pcbnew
    **  only modules on the present layer are subject to individual module
@@ -1194,7 +1210,7 @@ email address.
    line e.g. "make -f makefile.gtk KICAD_STATIC_LINK=0"


2007-June-11 UPDATE   Dick Hollenbeck <dickelbeck@yahoo.com>
2007-June-11 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
+ Started this change log file.

+2 −0
Original line number Diff line number Diff line
@@ -447,6 +447,7 @@ TRACK* TRACK::GetBestInsertPoint( BOARD* Pcb )
    /* Traitement du debut de liste */
    if( track == NULL )
        return NULL;                    /* No tracks ! */
    
    if( GetNet() < track->GetNet() )    /* no net code or net code = 0 (track not connected) */
        return NULL;

@@ -454,6 +455,7 @@ TRACK* TRACK::GetBestInsertPoint( BOARD* Pcb )
    {
        if( NextTrack->GetNet() > this->GetNet() )
            break;
        
        track = NextTrack;
    }

+9 −6
Original line number Diff line number Diff line
@@ -68,25 +68,28 @@ public:
     */ 
    bool Save( FILE* aFile ) const;
    
    
    /**
     * Function Insert
     * inserts a TRACK, SEGVIA or SEGZONE into its proper list, either at the
     * inserts a single TRACK, SEGVIA or SEGZONE, or a list of such,
     * into the proper list within a BOARD, either at the
     * list's front or immediately after the InsertPoint.
     * If Insertpoint == NULL, then insert at the beginning of the proper list.
     * If InsertPoint != NULL, then insert immediately after InsertPoint.
     * TRACKs and SEGVIAs are put on the m_Track list, SEGZONE on the m_Zone list.
     * @param aPcb The BOARD to insert into.
     * @param InsertPoint See above
     */
    void    Insert( BOARD* Pcb, BOARD_ITEM* InsertPoint );
    void    Insert( BOARD* aPcb, BOARD_ITEM* InsertPoint );
    
    /**
     * Function GetBestInsertPoint
     * searches the "best" insertion point within the track linked list.
     * The best point is the of the corresponding net code section.
     * The best point is the begging of the corresponding net code section.
     * (The BOARD::m_Track and BOARD::m_Zone lists are sorted by netcode.)
     * @param aPcb The BOARD to search for the insertion point. 
     * @return TRACK* - the item found in the linked list (or NULL if no track)
     */
    TRACK*  GetBestInsertPoint( BOARD* Pcb );
    TRACK*  GetBestInsertPoint( BOARD* aPcb );

    /* Search (within the track linked list) the first segment matching the netcode
     * ( the linked list is always sorted by net codes )
+10 −2
Original line number Diff line number Diff line
@@ -32,6 +32,14 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track )
    if( Track == NULL )
        return NULL;
    
    if( Track->GetState(DELETED) )
    {
#if defined(DEBUG)        
        printf("WinEDA_PcbFrame::Delete_Segment(): bug deleted already deleted TRACK\n");
#endif        
        return NULL;
    }

    if( Track->m_Flags & IS_NEW )  // Trace en cours, on peut effacer le dernier segment
    {
        if( g_TrackSegmentCount > 0 )
@@ -48,7 +56,8 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track )
            g_TrackSegmentCount--;

            if( g_TwoSegmentTrackBuild )
            {   // g_CurrentTrackSegment->Pback must not be a via, or we want delete also the via
            {   
                // g_CurrentTrackSegment->Pback must not be a via, or we want delete also the via
                if( (g_TrackSegmentCount >= 2)
                   && (g_CurrentTrackSegment->Type() != TYPEVIA)
                   && (g_CurrentTrackSegment->Pback->Type() == TYPEVIA) )
@@ -132,7 +141,6 @@ void WinEDA_PcbFrame::Delete_Track( wxDC* DC, TRACK* Track )
        Supprime_Une_Piste( DC, Track );
        GetScreen()->SetModify();
        test_1_net_connexion( DC, current_net_code );
        m_Pcb->Display_Infos( this );
    }
}

+33 −29
Original line number Diff line number Diff line
@@ -25,13 +25,12 @@ public:
    ~DRAG_SEGM();

    void SetInitialValues();

};

/* Variables */

eda_global DRAG_SEGM* g_DragSegmentList;    /* pointe le debut de la liste
										des structures DRAG_SEGM */
                                             *  des structures DRAG_SEGM */

/* routines specifiques */
void    Dessine_Segments_Dragges( WinEDA_DrawPanel* panel, wxDC* DC );
@@ -40,6 +39,11 @@ void Build_1_Pad_SegmentsToDrag(WinEDA_DrawPanel * panel, wxDC * DC, D_PAD * PtP
void    Collect_TrackSegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC,
                                     wxPoint& point, int MasqueLayer, int net_code );
void    EraseDragListe();


/* Add the segment"Track" to the drag list, and erase it from screen
 * flag = STARTPOINT (if the point to drag is the start point of Track) 
 * or ENDPOINT 
 */
void    AddSegmentToDragList( WinEDA_DrawPanel* panel, wxDC* DC,
	int flag, TRACK * Track); /* Add the segment"Track" to the drag list, and erase it from screen
	flag = STARTPOINT (if the point to drag is the start point of Track) or ENDPOINT */
                              int flag, TRACK* Track );
Loading