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

Re: gEDA-dev: Problems with component selector



Hi,

El lun, 23-10-2006 a las 22:50 +0200, Carlos Nieves Ónega escribió:
> Hi,
> I have a problem with the component selector, which affects CVS HEAD and
> the last geda/gaf release. Steps to reproduce it:
>  - Run gschem.
>  - Open the component selector, and select one component (7400-1.sym).
>  - Go to the gschem's window and place one there. 
>  - Back to the component selector, click the Cancel button.
>  - Back to gschem, you can still place components. Hit the escape key.
>  - Open the component selector again, and select the same component as
> before (7400-1.sym).
>  - Go to gschem's window: the component is not drawn.
>  - Hit the apply button in the component selector and go back to
> gschem's window: the component is not drawn.
>  - If I click on the gschem's window several times (to see if it is a
> drawing problem), then click the cancel button of the component
> selector, and afterwards do a view->redraw. No new component is shown.

It seems the problem is in x_compselect.c, function
x_compselect_callback_response:

[snip]
if (toplevel->current_clib == NULL ||
     g_ascii_strcasecmp (toplevel->current_clib, directory) != 0 ||
     toplevel->current_basename == NULL ||
     g_ascii_strcasecmp (toplevel->current_basename, component) != 0) {
  [redraw component]
}

The problem is that the second time, both toplevel->current_clib and
toplevel->current_basename are the same, so the redrawing code is not
executed.

The attached patch seems to work for me.

Regards,

Carlos
Index: x_compselect.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_compselect.c,v
retrieving revision 1.8
diff -u -r1.8 x_compselect.c
--- x_compselect.c	13 Oct 2006 14:43:28 -0000	1.8
+++ x_compselect.c	24 Oct 2006 18:02:26 -0000
@@ -119,33 +119,32 @@
             g_ascii_strcasecmp (toplevel->current_clib, directory) != 0 ||
             toplevel->current_basename == NULL ||
             g_ascii_strcasecmp (toplevel->current_basename, component) != 0) {
-          gint diff_x, diff_y;
-          
-          g_free (toplevel->current_clib);
+	  g_free (toplevel->current_clib);
           toplevel->current_clib = directory;
         
           strcpy (toplevel->current_basename, component);
-          g_free (component);
-        
-          if (toplevel->event_state == ENDCOMP) {
-            diff_x = toplevel->last_x - toplevel->start_x;
-            diff_y = toplevel->last_y - toplevel->start_y;
-            
-            o_complex_translate_display(toplevel,
-                                        diff_x, diff_y,
-                                        toplevel->page_current->complex_place_head);
-          }
+	} else {
+	  g_free(directory);
+	}
+	g_free (component);
+	if (toplevel->event_state == ENDCOMP) {
+          gint diff_x, diff_y;
+
+	  diff_x = toplevel->last_x - toplevel->start_x;
+	  diff_y = toplevel->last_y - toplevel->start_y;
+	  
+	  o_complex_translate_display(toplevel,
+				      diff_x, diff_y,
+				      toplevel->page_current->complex_place_head);
+	}
         
-          o_list_delete_rest(toplevel,
-                             toplevel->page_current->complex_place_head);
-          o_complex_set_filename(toplevel, toplevel->current_clib,
-                                 toplevel->current_basename);
+	o_list_delete_rest(toplevel,
+			   toplevel->page_current->complex_place_head);
+	o_complex_set_filename(toplevel, toplevel->current_clib,
+			       toplevel->current_basename);
         
-          toplevel->event_state = DRAWCOMP;
-        } else {
-          g_free (component);
-          g_free (directory);
-        }
+	toplevel->event_state = DRAWCOMP;
+
         break;
       }
       case GTK_RESPONSE_CLOSE:


_______________________________________________
geda-dev mailing list
geda-dev@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev