Index: trunk/src/event.h =================================================================== --- trunk/src/event.h (revision 28013) +++ trunk/src/event.h (revision 28014) @@ -81,7 +81,7 @@ PCB_EVENT_DAD_NEW_DIALOG, /* called by the GUI after a new DAD dialog is open; args are pointer hid_ctx, string dialog id and a pointer to int[4] for getting back preferre {x,y,w,h} (-1 means unknown) */ PCB_EVENT_DAD_NEW_GEO, /* called by the GUI after the window geometry got reconfigured; args are: void *hid_ctx, const char *dialog id, int x1, int y1, int width, int height */ - PCB_EVENT_NET_INDICATE_SHORT, /* called by core to get a shortcircuit indicated (e.g. by mincut). Args: (pcb_net_t *net, pcb_any_obj_t *offending_term, pcb_net_t *offending_net, int *handled) - if *handled is non-zero, the short is already indicated */ + PCB_EVENT_NET_INDICATE_SHORT, /* called by core to get a shortcircuit indicated (e.g. by mincut). Args: (pcb_net_t *net, pcb_any_obj_t *offending_term, pcb_net_t *offending_net, int *handled, int *cancel) - if *handled is non-zero, the short is already indicated; if *cancel is non-zero the whole process is cancelled, no more advanced short checking should take place in this session */ PCB_EVENT_last /* not a real event */ } pcb_event_id_t; Index: trunk/src/netlist.c =================================================================== --- trunk/src/netlist.c (revision 28013) +++ trunk/src/netlist.c (revision 28014) @@ -329,6 +329,7 @@ sctx->changed = 0; sctx->missing = 0; sctx->num_shorts = 0; + sctx->cancel_advanced = 0; htsp_init(&sctx->found, strhash, strkeyeq); } @@ -394,7 +395,7 @@ else pcb_message(PCB_MSG_WARNING, "SHORT: net \"%s\" is shorted to terminal %s-%s\n", sctx->current_net->name, sc->refdes, offender->term); - pcb_event(&PCB->hidlib, PCB_EVENT_NET_INDICATE_SHORT, "pppp", sctx->current_net, offender, offn, &handled); + pcb_event(&PCB->hidlib, PCB_EVENT_NET_INDICATE_SHORT, "ppppp", sctx->current_net, offender, offn, &handled, &sctx->cancel_advanced); if (!handled) { pcb_net_term_t *orig_t = pcb_termlist_first(&sctx->current_net->conns); pcb_any_obj_t *orig_o = pcb_term_find_name(sctx->pcb, sctx->pcb->Data, PCB_LYT_COPPER, orig_t->refdes, orig_t->term, NULL, NULL); Index: trunk/src/netlist.h =================================================================== --- trunk/src/netlist.h (revision 28013) +++ trunk/src/netlist.h (revision 28014) @@ -141,6 +141,7 @@ pcb_net_t *current_net; htsp_t found; pcb_cardinal_t changed, missing, num_shorts; + int cancel_advanced; /* do not do any time consuming advanced operations (such as mincut) in the event handler because the user already clicked cancel */ } pcb_short_ctx_t; void pcb_net_short_ctx_init(pcb_short_ctx_t *sctx, const pcb_board_t *pcb, pcb_net_t *net); Index: trunk/src_plugins/mincut/rats_mincut.c =================================================================== --- trunk/src_plugins/mincut/rats_mincut.c (revision 28013) +++ trunk/src_plugins/mincut/rats_mincut.c (revision 28014) @@ -325,10 +325,9 @@ static void pcb_mincut_ev(pcb_hidlib_t *hidlib, void *user_data, int argc, pcb_event_arg_t argv[]) { - int *handled; + int *handled, *cancel; pcb_any_obj_t *term; pcb_net_t *Snet, *Tnet; - int cancel = 0; if (!conf_mincut.plugins.mincut.enable) return; @@ -336,10 +335,11 @@ if (argc < 5) return; - if (argv[4].type != PCB_EVARG_PTR) + if ((argv[4].type != PCB_EVARG_PTR) || (argv[5].type != PCB_EVARG_PTR)) return; handled = (int *)argv[4].d.p; - if (*handled) + cancel = (int *)argv[5].d.p; + if (*handled || *cancel) return; if (argv[2].type != PCB_EVARG_PTR) @@ -354,7 +354,7 @@ return; Tnet = (pcb_net_t *)argv[3].d.p; - if (proc_short(term, Snet, Tnet, &cancel) == 0) + if (proc_short(term, Snet, Tnet, cancel) == 0) *handled = 1; }