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

gEDA: PCB core dump on undo



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


*** pcb-20060422-orig/src/action.c	2006-04-13 04:45:40.000000000 -0700
--- pcb-20060422/src/action.c	2006-04-27 14:31:47.000000000 -0700
***************
*** 5388,5398 ****
  	    {
  	      int type;
  	      void *ptr1, *ptr3, *ptrtmp;
! 	      LineTypePtr ptr2;
! 	      /* this search is guranteed to succeed */
  	      SearchObjectByLocation (LINE_TYPE, &ptr1, &ptrtmp,
  				      &ptr3, Crosshair.AttachedLine.Point1.X,
  				      Crosshair.AttachedLine.Point1.Y, 0);
  	      ptr2 = (LineTypePtr) ptrtmp;
  
  	      /* save both ends of line */
--- 5388,5400 ----
  	    {
  	      int type;
  	      void *ptr1, *ptr3, *ptrtmp;
! 	      LineTypePtr ptr2 = NULL;
! 	      int retType =
  	        SearchObjectByLocation (LINE_TYPE, &ptr1, &ptrtmp,
  				      &ptr3, Crosshair.AttachedLine.Point1.X,
  				      Crosshair.AttachedLine.Point1.Y, 0);
+ 	      if (NO_TYPE == retType || !ptr2)
+ 		return 1;
  	      ptr2 = (LineTypePtr) ptrtmp;
  
  	      /* save both ends of line */