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

gEDA-cvs: pcb.git: branch: master updated (c12cc6f769b5ccc603a75361fae3adc930934506)



The branch, master has been updated
       via  c12cc6f769b5ccc603a75361fae3adc930934506 (commit)
      from  498e5dd36d279a16f2eff27b69967c6aa9f7c31f (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
=========

 src/buffer.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)


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

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

    buffer.c: Update polygon r-tree when adding a polygon to the buffer.
    
    This resulted in a crash when rotating a buffer containing a polygon,
    as the polygon r-tree associated with the buffer was NULL despite the
    polygon count being non-zero.
    
    Reported-by: Gabriel Paubert <paubert@xxxxxxx>

:100644 100644 b396918... 2e63af5... M	src/buffer.c

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

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

    buffer.c: Update polygon r-tree when adding a polygon to the buffer.
    
    This resulted in a crash when rotating a buffer containing a polygon,
    as the polygon r-tree associated with the buffer was NULL despite the
    polygon count being non-zero.
    
    Reported-by: Gabriel Paubert <paubert@xxxxxxx>

diff --git a/src/buffer.c b/src/buffer.c
index b396918..2e63af5 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -196,6 +196,15 @@ AddPolygonToBuffer (LayerTypePtr Layer, PolygonTypePtr Polygon)
 
   polygon = CreateNewPolygon (layer, Polygon->Flags);
   CopyPolygonLowLevel (polygon, Polygon);
+
+  /* Update the polygon r-tree. Unlike similarly named functions for
+   * other objects, CreateNewPolygon does not do this as it creates a
+   * skeleton polygon object, which won't have correct bounds.
+   */
+  if (!layer->polygon_tree)
+    layer->polygon_tree = r_create_tree (NULL, 0, 0);
+  r_insert_entry (layer->polygon_tree, (BoxType *)polygon, 0);
+
   CLEAR_FLAG (FOUNDFLAG | ExtraFlag, polygon);
   return (polygon);
 }




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