Index: trunk/src/extobj.c =================================================================== --- trunk/src/extobj.c (revision 28742) +++ trunk/src/extobj.c (revision 28743) @@ -171,3 +171,12 @@ pcb_extobj_edit_pre(edit_obj); pcb_extobj_edit_geo(edit_obj); } + +void pcb_extobj_del_pre(pcb_any_obj_t *edit_obj) +{ + pcb_subc_t *sc = pcb_extobj_get_subcobj_by_attr(edit_obj); + pcb_extobj_t *eo; + + if (sc != NULL) + pcb_subc_remove(sc); +} Index: trunk/src/extobj.h =================================================================== --- trunk/src/extobj.h (revision 28742) +++ trunk/src/extobj.h (revision 28743) @@ -69,6 +69,10 @@ copy all data from there (including objects). */ void pcb_extobj_new_subc(pcb_any_obj_t *edit_obj, pcb_subc_t *subc_copy_from); +/* called before an edit-obj is removed */ +void pcb_extobj_del_pre(pcb_any_obj_t *edit_obj); + + int pcb_extobj_lookup_idx(const char *name); extern int pcb_extobj_invalid; /* this changes upon each new extobj reg, forcing the caches to be invalidated eventually */ Index: trunk/src/remove.c =================================================================== --- trunk/src/remove.c (revision 28742) +++ trunk/src/remove.c (revision 28743) @@ -30,6 +30,7 @@ #include "board.h" #include "draw.h" +#include "extobj.h" #include "remove.h" #include "select.h" #include "undo.h" @@ -98,6 +99,7 @@ ctx.remove.pcb = PCB; ctx.remove.destroy_target = NULL; + pcb_extobj_del_pre(Ptr2); ptr = pcb_object_operation(&RemoveFunctions, &ctx, Type, Ptr1, Ptr2, Ptr3); pcb_draw(); return ptr;