[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gEDA: PCB core dump on undo



On Friday 28 April 2006 16:39, Dan McMahill wrote:
> Dan McMahill wrote:
> > Daniel Wisehart wrote:
> >> If I start adding line segments to the rat lines layer, and after
> >> adding a segment or two but still in the middle of the command, I type
> >> a 'u', PCB core dumps.  The problem is that SearchObjectByLocation()
> >> is failing to find anything.
> >>
> >> Here is a patch that keeps PCB from core dumping, but I think that
> >> SearchObjectByLocation() probably needs looking at.
> >>
> >> Regards,
> >> Daniel
> >
> > The reason SearchObjectByLocation is failing is we need to search for
> > RATLINE_TYPE as well:
> >
> >
> >
> > --- action.c    12 Apr 2006 22:51:02 -0000      1.81
> > +++ action.c    28 Apr 2006 23:32:04 -0000
> > @@ -5391,5 +5391,5 @@
> >               LineTypePtr ptr2;
> >               /* this search is guranteed to succeed */
> > -             SearchObjectByLocation (LINE_TYPE, &ptr1, &ptrtmp,
> > +             SearchObjectByLocation (LINE_TYPE | RATLINE_TYPE, &ptr1,
> > &ptrtmp,
> >                                       &ptr3,
> > Crosshair.AttachedLine.Point1.X,
> >                                       Crosshair.AttachedLine.Point1.Y,
> > 0);
> >
> >
> > This almost fixes it.  I can add a bunch of ratline segments.  I hit 'u'
> > and each time I do that, it undoes the last segment.  This works all the
> > way up until I just have the initial point.  One more 'u' and I segfault
> > again.  I think the problem there is I should not be in this section of
> > code (Crosshair.AttachedLine.State == STATE_THIRD) anymore.  So, I'll
> > keep looking.
> >
> > -Dan
>
> oh, duh...  If I'd kept reading the code I would have seen a few more
> spots a few lines down where RATLINE_TYPE needed to be or-ed in.  And
> also it looks like we weren't quite keeping track of the number of added
> line segments.
>
> Try the attached patch.
>
> -Dan

Thanks, Dan.  It works for me.

Daniel