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

gEDA-cvs: gaf.git: branch: stable-1.6 updated (1.6.0-20091004-15-g7575c11)



The branch, stable-1.6 has been updated
       via  7575c114b590077a3399d28a499005625f7ae212 (commit)
      from  e5604faa09629ddd06ebc8377de4e42a7cd622d2 (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 |    1 +
 gschem/src/o_misc.c        |   61 +++++++++++++++++++++++--------------------
 gschem/src/o_place.c       |   14 ++++------
 3 files changed, 40 insertions(+), 36 deletions(-)


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

commit 7575c114b590077a3399d28a499005625f7ae212
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Don't update page connectivity from o_place_rotate()  Bug #2904715
    
    This fixes bug #2904715, where gschem would crash if an object being
    multi-copied contained nets, and the place-buffer was rotated (by 90
    degrees) four times during the place operation.
    
    Items in the place list should never have their connectivity updated
    on the page. (They don't belong to the page, so have no business
    being referenced from the page, or objects on it).
    
    Rather than calling o_rotate_world_update() (which updates connectivity)
    call o_glist_rotate_world() and then the scheme rotate hooks explictly.
    
    Rotate hook handling was split from o_rotate_world_update() into a new
    function, o_rotate_call_hooks(). When doing this split, I took the
    chance to remove a few pointless tests of o_current != NULL in there.
    We know o_current isn't going to be NULL, and we already dereferenced
    it (unchecked) a few lines above.
    
    As o_place_rotate() is always called from within an action - and in
    those cases, o_rotate_world_update() would not update the undo list,
    I have not included the conditional undo update in o_place_rotate().
    (cherry picked from commit 16090ce2eedc014d82e96fd340ec27f9ea6b186d)

:100644 100644 81e6a3b... 4983e1f... M	gschem/include/prototype.h
:100644 100644 93275ff... 6cda6df... M	gschem/src/o_misc.c
:100644 100644 de27598... c19c0a7... M	gschem/src/o_place.c

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

commit 7575c114b590077a3399d28a499005625f7ae212
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Don't update page connectivity from o_place_rotate()  Bug #2904715
    
    This fixes bug #2904715, where gschem would crash if an object being
    multi-copied contained nets, and the place-buffer was rotated (by 90
    degrees) four times during the place operation.
    
    Items in the place list should never have their connectivity updated
    on the page. (They don't belong to the page, so have no business
    being referenced from the page, or objects on it).
    
    Rather than calling o_rotate_world_update() (which updates connectivity)
    call o_glist_rotate_world() and then the scheme rotate hooks explictly.
    
    Rotate hook handling was split from o_rotate_world_update() into a new
    function, o_rotate_call_hooks(). When doing this split, I took the
    chance to remove a few pointless tests of o_current != NULL in there.
    We know o_current isn't going to be NULL, and we already dereferenced
    it (unchecked) a few lines above.
    
    As o_place_rotate() is always called from within an action - and in
    those cases, o_rotate_world_update() would not update the undo list,
    I have not included the conditional undo update in o_place_rotate().
    (cherry picked from commit 16090ce2eedc014d82e96fd340ec27f9ea6b186d)

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 81e6a3b..4983e1f 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -613,6 +613,7 @@ void o_edit(GSCHEM_TOPLEVEL *w_current, GList *list);
 void o_lock(GSCHEM_TOPLEVEL *w_current);
 void o_unlock(GSCHEM_TOPLEVEL *w_current);
 void o_rotate_world_update(GSCHEM_TOPLEVEL *w_current, int centerx, int centery, int angle, GList *list);
+void o_rotate_call_hooks(GSCHEM_TOPLEVEL *w_current, GList *list);
 void o_mirror_world_update(GSCHEM_TOPLEVEL *w_current, int centerx, int centery, GList *list);
 void o_edit_show_hidden_lowlevel(GSCHEM_TOPLEVEL *w_current, const GList *o_list);
 void o_edit_show_hidden(GSCHEM_TOPLEVEL *w_current, const GList *o_list);
diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index 93275ff..6cda6df 100644
--- a/gschem/src/o_misc.c
+++ b/gschem/src/o_misc.c
@@ -240,50 +240,55 @@ void o_rotate_world_update(GSCHEM_TOPLEVEL *w_current,
   g_list_free (connected_objects);
   connected_objects = NULL;
 
-  /* All objects were rotated. Do a 2nd pass to run the rotate hooks */
+  /* All objects were rotated. Run the rotate hooks */
+  o_rotate_call_hooks (w_current, list);
+
+  /* Don't save the undo state if we are inside an action */
+  /* This is useful when rotating the selection while moving, for example */
+  toplevel->page_current->CHANGED = 1;
+  if (!w_current->inside_action) {
+    o_undo_savestate(w_current, UNDO_ALL);
+  }
+}
+
+
+void o_rotate_call_hooks (GSCHEM_TOPLEVEL *w_current, GList *list)
+{
+  TOPLEVEL *toplevel = w_current->toplevel;
+  OBJECT *o_current;
+  GList *iter;
+
   /* Do not run any hooks for simple objects here, like text, since they
      were rotated in the previous pass, and the selection list can contain
      an object and all its attributes (text) */
-  o_iter = list;
-  while (o_iter != NULL) {
-    o_current = o_iter->data;
+  for (iter = list; iter != NULL; iter = g_list_next (iter)) {
+    o_current = iter->data;
 
-    switch(o_current->type) {
-      case(OBJ_PIN):
+    switch (o_current->type) {
+      case OBJ_PIN:
         /* Run the rotate pin hook */
-        if (scm_hook_empty_p(rotate_pin_hook) == SCM_BOOL_F &&
-            o_current != NULL) {
-          scm_run_hook(rotate_pin_hook,
-                       scm_cons(g_make_object_smob(toplevel, o_current),
-                                SCM_EOL));
+        if (scm_hook_empty_p (rotate_pin_hook) == SCM_BOOL_F) {
+          scm_run_hook (rotate_pin_hook,
+                        scm_cons (g_make_object_smob (toplevel, o_current),
+                                  SCM_EOL));
         }
         break;
 
-      case (OBJ_COMPLEX):
+      case OBJ_COMPLEX:
         /* Run the rotate hook */
-        if (scm_hook_empty_p(rotate_component_object_hook) == SCM_BOOL_F &&
-            o_current != NULL) {
-          scm_run_hook(rotate_component_object_hook,
-                       scm_cons(g_make_object_smob(toplevel, o_current),
-                                SCM_EOL));
+        if (scm_hook_empty_p (rotate_component_object_hook) == SCM_BOOL_F) {
+          scm_run_hook (rotate_component_object_hook,
+                        scm_cons (g_make_object_smob (toplevel, o_current),
+                                  SCM_EOL));
         }
         break;
-    default:
+
+      default:
         break;
     }
-
-    o_iter = g_list_next(o_iter);
-  }
-
-  /* Don't save the undo state if we are inside an action */
-  /* This is useful when rotating the selection while moving, for example */
-  toplevel->page_current->CHANGED = 1;
-  if (!w_current->inside_action) {
-    o_undo_savestate(w_current, UNDO_ALL);
   }
 }
 
-
 /*! \todo Finish function documentation!!!
  *  \brief
  *  \par Function Description
diff --git a/gschem/src/o_place.c b/gschem/src/o_place.c
index de27598..c19c0a7 100644
--- a/gschem/src/o_place.c
+++ b/gschem/src/o_place.c
@@ -319,12 +319,10 @@ void o_place_draw_rubber (GSCHEM_TOPLEVEL *w_current, int drawing)
 void o_place_rotate (GSCHEM_TOPLEVEL *w_current)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
-  int savestate;
-
-  savestate = toplevel->DONT_REDRAW;
-  toplevel->DONT_REDRAW = 1;
-  o_rotate_world_update (w_current,
-                         w_current->first_wx, w_current->first_wy,
-                         90, toplevel->page_current->place_list);
-  toplevel->DONT_REDRAW = savestate;
+
+  o_glist_rotate_world (toplevel,
+                        w_current->first_wx, w_current->first_wy, 90,
+                        toplevel->page_current->place_list);
+  /* All objects were rotated. Run the rotate hooks */
+  o_rotate_call_hooks (w_current, toplevel->page_current->place_list);
 }




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