Index: trunk/src/obj_poly.h =================================================================== --- trunk/src/obj_poly.h (revision 15083) +++ trunk/src/obj_poly.h (revision 15084) @@ -206,6 +206,14 @@ it to dst - implemented in polygon.c */ void pcb_poly_pa_clearance_construct(pcb_polyarea_t **dst, pcb_poly_it_t *it, pcb_coord_t clearance); + +#define pcb_poly_ppclear_at(poly, layer) \ +do { \ + if (layer->is_bound) layer = layer->meta.bound.real; \ + if (PCB_POLY_HAS_CLEARANCE(poly) && (layer != NULL)) \ + pcb_poly_clear_from_poly(layer->parent, PCB_TYPE_POLY, layer, poly); \ +} while(0) + /* Let the poly clear sorrunding polys in its layer */ #define pcb_poly_ppclear(poly) \ do { \ @@ -212,9 +220,7 @@ if (poly->parent.layer != NULL) { \ pcb_layer_t *layer = pcb_layer_get_real(poly->parent.layer); \ if ((layer != NULL) && (layer->parent->parent_type == PCB_PARENT_BOARD)) { \ - if (layer->is_bound) layer = layer->meta.bound.real; \ - if (PCB_POLY_HAS_CLEARANCE(poly) && (layer != NULL)) \ - pcb_poly_clear_from_poly(layer->parent, PCB_TYPE_POLY, layer, poly); \ + pcb_poly_ppclear_at(poly, layer); \ } \ } \ } while(0) Index: trunk/src/obj_subc.c =================================================================== --- trunk/src/obj_subc.c (revision 15083) +++ trunk/src/obj_subc.c (revision 15084) @@ -1223,8 +1223,8 @@ pcb_r_insert_entry(dl->polygon_tree, (pcb_box_t *)poly); chg++; } - if (dst_is_pcb) - pcb_poly_ppclear(poly); + if (dst_is_pcb && (dl != NULL)) + pcb_poly_ppclear_at(poly, dl); } if (!dst_is_pcb) {