From: oharboe at B. <oh...@ma...> - 2009-09-11 08:58:49
|
Author: oharboe Date: 2009-09-11 08:58:49 +0200 (Fri, 11 Sep 2009) New Revision: 2690 Modified: trunk/src/target/target.c Log: registering a target event twice caused infinite loop. Same bug as in jtag/core.c copy & pasted. Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-09-11 06:08:51 UTC (rev 2689) +++ trunk/src/target/target.c 2009-09-11 06:58:49 UTC (rev 2690) @@ -2,7 +2,7 @@ * Copyright (C) 2005 by Dominic Rath * * Dom...@gm... * * * - * Copyright (C) 2007,2008 Øyvind Harboe * + * Copyright (C) 2007-2009 Øyvind Harboe * * oyv...@zy... * * * * Copyright (C) 2008, Duane Ellis * @@ -3547,9 +3547,11 @@ } if (goi->isconfigure) { + bool replace = true; if (teap == NULL) { /* create new */ teap = calloc(1, sizeof(*teap)); + replace = false; } teap->event = n->value; Jim_GetOpt_Obj(goi, &o); @@ -3569,9 +3571,12 @@ */ Jim_IncrRefCount(teap->body); - /* add to head of event list */ - teap->next = target->event_action; - target->event_action = teap; + if (!replace) + { + /* add to head of event list */ + teap->next = target->event_action; + target->event_action = teap; + } Jim_SetEmptyResult(goi->interp); } else { /* get */ |