[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.6.0-20091004-86-g9c71110)



The branch, master has been updated
       via  9c71110a49be8a677f7ea3eabaebf6479873c7af (commit)
       via  040db4675fcbd7739ad8c0dfbc82bbcf2eaff815 (commit)
       via  d03c03949e17313a222645fc38c376b802f5fb4c (commit)
       via  2998c43e60e95a28df9ce7db2cd64dfaf46712b9 (commit)
       via  b635dd1c3b9297d3f6e1487f4e2a03cc9effcf05 (commit)
      from  375c146d8700ea02a31edb10dfebcde4b85d7aa1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gschem/include/prototype.h |    2 +-
 gschem/src/o_attrib.c      |    5 +-
 gschem/src/o_slot.c        |  130 ++++++++++++++++++--------------------------
 gschem/src/o_text.c        |   10 ++--
 gschem/src/x_autonumber.c  |   35 +++---------
 gschem/src/x_dialog.c      |    3 +-
 6 files changed, 74 insertions(+), 111 deletions(-)


=================
 Commit Messages
=================

commit 9c71110a49be8a677f7ea3eabaebf6479873c7af
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Fix update of pinnumbers after auto-renumberering slots
    
    Call o_slot_end() rather than o_text_set_string(), in order to
    ensure the object's pinnumbers are updated correctly.
    
    NB: This patch requires the changes making o_slot_end() to take an
    OBJECT * arguement, as the objects being updated aren't necessarily
    selected.

:100644 100644 f6c2f5b... 9b9e7f9... M	gschem/src/x_autonumber.c

commit 040db4675fcbd7739ad8c0dfbc82bbcf2eaff815
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Pass o_slot_end() an OBJECT *object parameter
    
    The OBJECT * parameter points to the object who's slot is being
    updated - not the slot attribute itself.
    
    Previously o_slot_end() used the first object in the selection.
    This call is used for other cases where slotting needs to be
    updated - not all will necessarily have the object selected.

:100644 100644 ba6fb20... 71571f1... M	gschem/include/prototype.h
:100644 100644 9cac6c1... 9d46a08... M	gschem/src/o_attrib.c
:100644 100644 3a73abd... 0e593c1... M	gschem/src/o_slot.c
:100644 100644 4210ce1... 16cc4c0... M	gschem/src/o_text.c
:100644 100644 70e7686... d8f85cb... M	gschem/src/x_dialog.c

commit d03c03949e17313a222645fc38c376b802f5fb4c
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Remove the exit(-1) error path from o_slot_end()
    
    This is not a friendly way to treat the user.. g_return_if_fail() instead.

:100644 100644 081055f... 3a73abd... M	gschem/src/o_slot.c

commit 2998c43e60e95a28df9ce7db2cd64dfaf46712b9
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Remove unused "len" parameter from o_slot_end()

:100644 100644 4983e1f... ba6fb20... M	gschem/include/prototype.h
:100644 100644 e810fec... 9cac6c1... M	gschem/src/o_attrib.c
:100644 100644 5f9beee... 081055f... M	gschem/src/o_slot.c
:100644 100644 b766521... 4210ce1... M	gschem/src/o_text.c
:100644 100644 a4b9901... 70e7686... M	gschem/src/x_dialog.c

commit b635dd1c3b9297d3f6e1487f4e2a03cc9effcf05
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Fix slot editing routines to not edit inherited attributes (#2949232)
    
    Fixes a bug where symbols without a promoted slot= attribute had their
    non-promited slot= attribute modified. Also, a similar bug was lurking
    in the auto-number code, which could break the auto-number slots feature
    or cause crashes when the remove numbers feature was used on slotted
    components without a promoted slot= attribute.
    
    Tidied up some variable names to make all the fixed functions consistent.
    
    A neater fix might have been changing the interface to s_slot_search_slot()
    back, such that it only reports non-inherited attributes. This would
    ideally involve renaming the function in libgeda, to (say, for example)
    s_slot_search_attached_slot(). Since this change is intended for back-
    port to stable-1.6 as well, I don't want to break libgeda ABI. It seems
    unwise to change the function's behaviour without a break in API, hence
    the solution in this patch.. to have callers to s_slot_search_slot() check
    !o_attrib_is_inherited() on the returned attribute before editing it.
    
    Reported-by: John Doty <jpd@xxxxxxxxx>

:100644 100644 d0bac60... 5f9beee... M	gschem/src/o_slot.c
:100644 100644 ba123b9... f6c2f5b... M	gschem/src/x_autonumber.c

=========
 Changes
=========

commit 9c71110a49be8a677f7ea3eabaebf6479873c7af
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Fix update of pinnumbers after auto-renumberering slots
    
    Call o_slot_end() rather than o_text_set_string(), in order to
    ensure the object's pinnumbers are updated correctly.
    
    NB: This patch requires the changes making o_slot_end() to take an
    OBJECT * arguement, as the objects being updated aren't necessarily
    selected.

diff --git a/gschem/src/x_autonumber.c b/gschem/src/x_autonumber.c
index f6c2f5b..9b9e7f9 100644
--- a/gschem/src/x_autonumber.c
+++ b/gschem/src/x_autonumber.c
@@ -611,32 +611,12 @@ void autonumber_remove_number(AUTONUMBER_TEXT * autotext, OBJECT *o_current)
 void autonumber_apply_new_text(AUTONUMBER_TEXT * autotext, OBJECT *o_current,
 			       gint number, gint slot)
 {
-  OBJECT *o_parent, *o_slot;
-  gchar *slot_str;
-  gchar *str = NULL;
+  char *str;
 
-  /* add the slot as attribute to the object */
-  o_parent = o_current->attached_to;
-  if (slot != 0 && o_parent != NULL) {
-    slot_str = s_slot_search_slot (o_parent, &o_slot);
-    g_free (slot_str);
-    if (o_slot != NULL && !o_attrib_is_inherited (o_slot)) {
-      /* update the attached slot attribute */
-      slot_str = g_strdup_printf("slot=%d",slot);
-      o_text_set_string (autotext->w_current->toplevel, o_slot, slot_str);
-      g_free (slot_str);
-      o_invalidate (autotext->w_current, o_slot);
-      o_text_recreate(autotext->w_current->toplevel, o_slot);
-      o_invalidate (autotext->w_current, o_slot);
-    }
-    else {
-      /* create a new attribute and attach it */
-      o_attrib_add_attrib(autotext->w_current,
-			  g_strdup_printf("slot=%d",slot),
-			  INVISIBLE, SHOW_NAME_VALUE,
-			  o_parent);
-    }
-  }
+  /* update the slot on the owning object */
+  str = g_strdup_printf ("slot=%d", slot);
+  o_slot_end (autotext->w_current, o_current->attached_to, str);
+  g_free (str);
 
   /* replace old text */
   str = g_strdup_printf("%s%d", autotext->current_searchtext, number);

commit 040db4675fcbd7739ad8c0dfbc82bbcf2eaff815
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Pass o_slot_end() an OBJECT *object parameter
    
    The OBJECT * parameter points to the object who's slot is being
    updated - not the slot attribute itself.
    
    Previously o_slot_end() used the first object in the selection.
    This call is used for other cases where slotting needs to be
    updated - not all will necessarily have the object selected.

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index ba6fb20..71571f1 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -707,7 +707,7 @@ void o_select_unselect_all(GSCHEM_TOPLEVEL *w_current);
 void o_select_move_to_place_list(GSCHEM_TOPLEVEL *w_current);
 /* o_slot.c */
 void o_slot_start(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
-void o_slot_end(GSCHEM_TOPLEVEL *w_current, const char *string);
+void o_slot_end(GSCHEM_TOPLEVEL *w_current, OBJECT *object, const char *string);
 /* o_text.c */
 int o_text_get_rendered_bounds(void *user_data, OBJECT *object, int *min_x, int *min_y, int *max_x, int *max_y);
 void o_text_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
diff --git a/gschem/src/o_attrib.c b/gschem/src/o_attrib.c
index 9cac6c1..9d46a08 100644
--- a/gschem/src/o_attrib.c
+++ b/gschem/src/o_attrib.c
@@ -269,8 +269,9 @@ OBJECT *o_attrib_add_attrib(GSCHEM_TOPLEVEL *w_current,
   o_invalidate (w_current, new_obj);
 
   /* handle slot= attribute, it's a special case */
-  if (g_ascii_strncasecmp (text_string, "slot=", 5) == 0) {
-    o_slot_end (w_current, text_string);
+  if (o_current != NULL &&
+      g_ascii_strncasecmp (text_string, "slot=", 5) == 0) {
+    o_slot_end (w_current, o_current, text_string);
   }
 
   /* Run the add attribute hook */
diff --git a/gschem/src/o_slot.c b/gschem/src/o_slot.c
index 3a73abd..0e593c1 100644
--- a/gschem/src/o_slot.c
+++ b/gschem/src/o_slot.c
@@ -62,11 +62,10 @@ void o_slot_start (GSCHEM_TOPLEVEL *w_current, OBJECT *object)
  *  \par Function Description
  *
  */
-void o_slot_end(GSCHEM_TOPLEVEL *w_current, const char *string)
+void o_slot_end(GSCHEM_TOPLEVEL *w_current, OBJECT *object, const char *string)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
   OBJECT *new_obj;
-  OBJECT *object;
   char *slot_value;
   char *numslots_value;
   OBJECT *o_slot;
@@ -75,15 +74,6 @@ void o_slot_end(GSCHEM_TOPLEVEL *w_current, const char *string)
   int new_slot_number;
   int status;
 
-  object = o_select_return_first_object (w_current);
-
-  /* get the parent object if the selection is only a text object */
-  if (object != NULL && object->type == OBJ_TEXT) {
-    if (object->attached_to != NULL) {
-      object = object->attached_to;
-    }
-  }
-
   g_return_if_fail (object != NULL);
 
   status = o_attrib_string_get_name_value (string, NULL, &value);
diff --git a/gschem/src/o_text.c b/gschem/src/o_text.c
index 4210ce1..16cc4c0 100644
--- a/gschem/src/o_text.c
+++ b/gschem/src/o_text.c
@@ -669,8 +669,9 @@ void o_text_edit_end(GSCHEM_TOPLEVEL *w_current, char *string, int len, int text
         if (numselect == 1 && string) {
           o_text_set_string (w_current->toplevel, object, string);
 	  /* handle slot= attribute, it's a special case */
-	  if (g_ascii_strncasecmp (string, "slot=", 5) == 0) {
-	    o_slot_end (w_current, string);
+	  if (object->attached_to != NULL &&
+	      g_ascii_strncasecmp (string, "slot=", 5) == 0) {
+	    o_slot_end (w_current, object->attached_to, string);
 	  }
         }
         o_text_recreate(toplevel, object);
@@ -717,8 +718,9 @@ void o_text_change(GSCHEM_TOPLEVEL *w_current, OBJECT *object, char *string,
   o_invalidate (w_current, object);
 
   /* handle slot= attribute, it's a special case */
-  if (g_ascii_strncasecmp (string, "slot=", 5) == 0) {
-    o_slot_end (w_current, string);
+  if (object->attached_to != NULL &&
+      g_ascii_strncasecmp (string, "slot=", 5) == 0) {
+    o_slot_end (w_current, object->attached_to, string);
   }
 
   toplevel->page_current->CHANGED = 1;
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index 70e7686..d8f85cb 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -2083,7 +2083,8 @@ void slot_edit_dialog_response(GtkWidget *widget, gint response, GSCHEM_TOPLEVEL
     len = strlen(string);
     if (len != 0) {
       slot_string = g_strdup_printf ("slot=%s", string);
-      o_slot_end(w_current, slot_string);
+      o_slot_end (w_current, o_select_return_first_object (w_current),
+                  slot_string);
       g_free (slot_string);
     }
     break;

commit d03c03949e17313a222645fc38c376b802f5fb4c
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Remove the exit(-1) error path from o_slot_end()
    
    This is not a friendly way to treat the user.. g_return_if_fail() instead.

diff --git a/gschem/src/o_slot.c b/gschem/src/o_slot.c
index 081055f..3a73abd 100644
--- a/gschem/src/o_slot.c
+++ b/gschem/src/o_slot.c
@@ -75,13 +75,7 @@ void o_slot_end(GSCHEM_TOPLEVEL *w_current, const char *string)
   int new_slot_number;
   int status;
 
-  status = o_attrib_string_get_name_value (string, NULL, &value);
-  if (!status) {
-    s_log_message(_("Slot attribute malformed\n"));
-    return;
-  }
-
-  object = o_select_return_first_object(w_current);
+  object = o_select_return_first_object (w_current);
 
   /* get the parent object if the selection is only a text object */
   if (object != NULL && object->type == OBJ_TEXT) {
@@ -90,79 +84,79 @@ void o_slot_end(GSCHEM_TOPLEVEL *w_current, const char *string)
     }
   }
 
-  if (object != NULL) {
-    numslots_value =
-      o_attrib_search_object_attribs_by_name (object, "numslots", 0);
+  g_return_if_fail (object != NULL);
 
-    if (!numslots_value) {
-      s_log_message(_("numslots attribute missing\n"));
-      s_log_message(_("Slotting not allowed for this component\n"));
-      g_free(value);
-      return;
-    }
+  status = o_attrib_string_get_name_value (string, NULL, &value);
+  if (!status) {
+    s_log_message (_("Slot attribute malformed\n"));
+    return;
+  }
 
-    numslots = atoi(numslots_value);
-    g_free(numslots_value);
+  numslots_value =
+    o_attrib_search_object_attribs_by_name (object, "numslots", 0);
+
+  if (!numslots_value) {
+    s_log_message (_("numslots attribute missing\n"));
+    s_log_message (_("Slotting not allowed for this component\n"));
+    g_free (value);
+    return;
+  }
 
-    new_slot_number = atoi(value);
+  numslots = atoi (numslots_value);
+  g_free (numslots_value);
+
+  new_slot_number = atoi (value);
 
 #if DEBUG
-    printf("numslots = %d\n", numslots);
+  printf ("numslots = %d\n", numslots);
 #endif
 
-    if (new_slot_number > numslots || new_slot_number <=0 ) {
-      s_log_message(_("New slot number out of range\n"));
-      g_free(value);
-      return;
-    }
+  if (new_slot_number > numslots || new_slot_number <=0 ) {
+    s_log_message (_("New slot number out of range\n"));
+    g_free (value);
+    return;
+  }
 
-    /* first see if slot attribute already exists outside
-     * complex */
-    slot_value = s_slot_search_slot (object, &o_slot);
-    g_free (slot_value);
-
-    if (o_slot != NULL && !o_attrib_is_inherited (o_slot)) {
-      o_text_set_string (toplevel, o_slot, string);
-
-      if (o_slot->visibility == VISIBLE ||
-          (o_slot->visibility == INVISIBLE && toplevel->show_hidden_text)) {
-        o_invalidate (w_current, o_slot);
-      }
-
-      o_text_recreate(toplevel, o_slot);
-
-      /* this doesn't deal with the selection list
-       * item */
-      if (o_slot->visibility == VISIBLE ||
-          (o_slot->visibility == INVISIBLE && toplevel->show_hidden_text)) {
-        o_invalidate (w_current, o_slot);
-      }
-
-    } else {
-      /* here you need to do the add the slot
-         attribute since it doesn't exist */
-      new_obj = o_text_new (toplevel, OBJ_TEXT, ATTRIBUTE_COLOR,
-                            object->complex->x, object->complex->y,
-                            LOWER_LEFT, 0, /* zero is angle */
-                            string, 10, INVISIBLE, SHOW_NAME_VALUE);
-      s_page_append (toplevel, toplevel->page_current, new_obj);
-
-      /* manually attach attribute */
-      o_attrib_attach (toplevel, new_obj, object, FALSE);
-    }
+  /* first see if slot attribute already exists outside
+   * complex */
+  slot_value = s_slot_search_slot (object, &o_slot);
+  g_free (slot_value);
 
-    o_invalidate (w_current, object);
-    s_slot_update_object (toplevel, object);
+  if (o_slot != NULL && !o_attrib_is_inherited (o_slot)) {
+    o_text_set_string (toplevel, o_slot, string);
 
-    o_invalidate (w_current,object);
+    if (o_slot->visibility == VISIBLE ||
+        (o_slot->visibility == INVISIBLE && toplevel->show_hidden_text)) {
+      o_invalidate (w_current, o_slot);
+    }
+
+    o_text_recreate (toplevel, o_slot);
 
-    toplevel->page_current->CHANGED = 1;
-    g_free(value);
+    /* this doesn't deal with the selection list
+     * item */
+    if (o_slot->visibility == VISIBLE ||
+        (o_slot->visibility == INVISIBLE && toplevel->show_hidden_text)) {
+      o_invalidate (w_current, o_slot);
+    }
 
   } else {
-    fprintf(stderr,
-            _("uggg! you tried to slot edit something that doesn't exist!\n"));
-    g_free(value);
-    exit(-1);
+    /* here you need to do the add the slot
+       attribute since it doesn't exist */
+    new_obj = o_text_new (toplevel, OBJ_TEXT, ATTRIBUTE_COLOR,
+                          object->complex->x, object->complex->y,
+                          LOWER_LEFT, 0, /* zero is angle */
+                          string, 10, INVISIBLE, SHOW_NAME_VALUE);
+    s_page_append (toplevel, toplevel->page_current, new_obj);
+
+    /* manually attach attribute */
+    o_attrib_attach (toplevel, new_obj, object, FALSE);
   }
+
+  o_invalidate (w_current, object);
+  s_slot_update_object (toplevel, object);
+
+  o_invalidate (w_current,object);
+
+  toplevel->page_current->CHANGED = 1;
+  g_free (value);
 }

commit 2998c43e60e95a28df9ce7db2cd64dfaf46712b9
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Remove unused "len" parameter from o_slot_end()

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 4983e1f..ba6fb20 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -707,7 +707,7 @@ void o_select_unselect_all(GSCHEM_TOPLEVEL *w_current);
 void o_select_move_to_place_list(GSCHEM_TOPLEVEL *w_current);
 /* o_slot.c */
 void o_slot_start(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
-void o_slot_end(GSCHEM_TOPLEVEL *w_current, const char *string, int len);
+void o_slot_end(GSCHEM_TOPLEVEL *w_current, const char *string);
 /* o_text.c */
 int o_text_get_rendered_bounds(void *user_data, OBJECT *object, int *min_x, int *min_y, int *max_x, int *max_y);
 void o_text_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
diff --git a/gschem/src/o_attrib.c b/gschem/src/o_attrib.c
index e810fec..9cac6c1 100644
--- a/gschem/src/o_attrib.c
+++ b/gschem/src/o_attrib.c
@@ -270,7 +270,7 @@ OBJECT *o_attrib_add_attrib(GSCHEM_TOPLEVEL *w_current,
 
   /* handle slot= attribute, it's a special case */
   if (g_ascii_strncasecmp (text_string, "slot=", 5) == 0) {
-    o_slot_end (w_current, text_string, strlen (text_string));
+    o_slot_end (w_current, text_string);
   }
 
   /* Run the add attribute hook */
diff --git a/gschem/src/o_slot.c b/gschem/src/o_slot.c
index 5f9beee..081055f 100644
--- a/gschem/src/o_slot.c
+++ b/gschem/src/o_slot.c
@@ -62,7 +62,7 @@ void o_slot_start (GSCHEM_TOPLEVEL *w_current, OBJECT *object)
  *  \par Function Description
  *
  */
-void o_slot_end(GSCHEM_TOPLEVEL *w_current, const char *string, int len)
+void o_slot_end(GSCHEM_TOPLEVEL *w_current, const char *string)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
   OBJECT *new_obj;
diff --git a/gschem/src/o_text.c b/gschem/src/o_text.c
index b766521..4210ce1 100644
--- a/gschem/src/o_text.c
+++ b/gschem/src/o_text.c
@@ -670,7 +670,7 @@ void o_text_edit_end(GSCHEM_TOPLEVEL *w_current, char *string, int len, int text
           o_text_set_string (w_current->toplevel, object, string);
 	  /* handle slot= attribute, it's a special case */
 	  if (g_ascii_strncasecmp (string, "slot=", 5) == 0) {
-	    o_slot_end (w_current, string, strlen (string));
+	    o_slot_end (w_current, string);
 	  }
         }
         o_text_recreate(toplevel, object);
@@ -718,7 +718,7 @@ void o_text_change(GSCHEM_TOPLEVEL *w_current, OBJECT *object, char *string,
 
   /* handle slot= attribute, it's a special case */
   if (g_ascii_strncasecmp (string, "slot=", 5) == 0) {
-    o_slot_end (w_current, string, strlen (string));
+    o_slot_end (w_current, string);
   }
 
   toplevel->page_current->CHANGED = 1;
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index a4b9901..70e7686 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -2083,7 +2083,7 @@ void slot_edit_dialog_response(GtkWidget *widget, gint response, GSCHEM_TOPLEVEL
     len = strlen(string);
     if (len != 0) {
       slot_string = g_strdup_printf ("slot=%s", string);
-      o_slot_end(w_current, slot_string, len);
+      o_slot_end(w_current, slot_string);
       g_free (slot_string);
     }
     break;

commit b635dd1c3b9297d3f6e1487f4e2a03cc9effcf05
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Fix slot editing routines to not edit inherited attributes (#2949232)
    
    Fixes a bug where symbols without a promoted slot= attribute had their
    non-promited slot= attribute modified. Also, a similar bug was lurking
    in the auto-number code, which could break the auto-number slots feature
    or cause crashes when the remove numbers feature was used on slotted
    components without a promoted slot= attribute.
    
    Tidied up some variable names to make all the fixed functions consistent.
    
    A neater fix might have been changing the interface to s_slot_search_slot()
    back, such that it only reports non-inherited attributes. This would
    ideally involve renaming the function in libgeda, to (say, for example)
    s_slot_search_attached_slot(). Since this change is intended for back-
    port to stable-1.6 as well, I don't want to break libgeda ABI. It seems
    unwise to change the function's behaviour without a break in API, hence
    the solution in this patch.. to have callers to s_slot_search_slot() check
    !o_attrib_is_inherited() on the returned attribute before editing it.
    
    Reported-by: John Doty <jpd@xxxxxxxxx>

diff --git a/gschem/src/o_slot.c b/gschem/src/o_slot.c
index d0bac60..5f9beee 100644
--- a/gschem/src/o_slot.c
+++ b/gschem/src/o_slot.c
@@ -67,10 +67,9 @@ void o_slot_end(GSCHEM_TOPLEVEL *w_current, const char *string, int len)
   TOPLEVEL *toplevel = w_current->toplevel;
   OBJECT *new_obj;
   OBJECT *object;
-  OBJECT *temp;
   char *slot_value;
   char *numslots_value;
-  OBJECT *slot_text_object;
+  OBJECT *o_slot;
   char *value = NULL;
   int numslots;
   int new_slot_number;
@@ -119,29 +118,26 @@ void o_slot_end(GSCHEM_TOPLEVEL *w_current, const char *string, int len)
 
     /* first see if slot attribute already exists outside
      * complex */
-    slot_value = s_slot_search_slot (object, &slot_text_object);
+    slot_value = s_slot_search_slot (object, &o_slot);
+    g_free (slot_value);
 
-    if (slot_value) {
-      o_text_set_string (toplevel, slot_text_object, string);
+    if (o_slot != NULL && !o_attrib_is_inherited (o_slot)) {
+      o_text_set_string (toplevel, o_slot, string);
 
-      temp = slot_text_object;
-
-      if (temp->visibility == VISIBLE ||
-          (temp->visibility == INVISIBLE && toplevel->show_hidden_text)) {
-        o_invalidate (w_current,temp);
+      if (o_slot->visibility == VISIBLE ||
+          (o_slot->visibility == INVISIBLE && toplevel->show_hidden_text)) {
+        o_invalidate (w_current, o_slot);
       }
 
-      o_text_recreate(toplevel, temp);
+      o_text_recreate(toplevel, o_slot);
 
       /* this doesn't deal with the selection list
        * item */
-      if (temp->visibility == VISIBLE ||
-          (temp->visibility == INVISIBLE && toplevel->show_hidden_text)) {
-        o_invalidate (w_current,temp);
+      if (o_slot->visibility == VISIBLE ||
+          (o_slot->visibility == INVISIBLE && toplevel->show_hidden_text)) {
+        o_invalidate (w_current, o_slot);
       }
 
-      g_free(slot_value);
-
     } else {
       /* here you need to do the add the slot
          attribute since it doesn't exist */
@@ -153,8 +149,6 @@ void o_slot_end(GSCHEM_TOPLEVEL *w_current, const char *string, int len)
 
       /* manually attach attribute */
       o_attrib_attach (toplevel, new_obj, object, FALSE);
-
-      slot_text_object = new_obj;
     }
 
     o_invalidate (w_current, object);
diff --git a/gschem/src/x_autonumber.c b/gschem/src/x_autonumber.c
index ba123b9..f6c2f5b 100644
--- a/gschem/src/x_autonumber.c
+++ b/gschem/src/x_autonumber.c
@@ -588,8 +588,9 @@ void autonumber_remove_number(AUTONUMBER_TEXT * autotext, OBJECT *o_current)
     o_parent = o_current->attached_to;
     if (o_parent != NULL) {
       slot_str = s_slot_search_slot (o_parent, &o_slot);
-      if (slot_str != NULL && o_slot != NULL) {
-        g_free(slot_str);
+      g_free (slot_str);
+      /* Only attempt to remove non-inherited slot attributes */
+      if (o_slot != NULL && !o_attrib_is_inherited (o_slot)) {
         /* delete the slot attribute */
         o_selection_remove (autotext->w_current->toplevel,
                             autotext->w_current->toplevel->
@@ -618,9 +619,9 @@ void autonumber_apply_new_text(AUTONUMBER_TEXT * autotext, OBJECT *o_current,
   o_parent = o_current->attached_to;
   if (slot != 0 && o_parent != NULL) {
     slot_str = s_slot_search_slot (o_parent, &o_slot);
-    if (slot_str != NULL) {
-      /* update the slot attribute */
-      g_free(slot_str);
+    g_free (slot_str);
+    if (o_slot != NULL && !o_attrib_is_inherited (o_slot)) {
+      /* update the attached slot attribute */
       slot_str = g_strdup_printf("slot=%d",slot);
       o_text_set_string (autotext->w_current->toplevel, o_slot, slot_str);
       g_free (slot_str);




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