]> git.sur5r.net Git - openocd/commitdiff
David Brownell <david-b@pacbell.net>:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 17 Jun 2009 06:40:50 +0000 (06:40 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 17 Jun 2009 06:40:50 +0000 (06:40 +0000)
Let jtag_call_event_callbacks() behave when the callback removes itself.
Oddly, this crashed on x86_32 but not x86_64.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2264 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/jtag/core.c

index a8d65f1e59000ddf21d42a1f9a0fad55a41cf706..aaa7da1f982655bf91849ffe59b4121f43f5803c 100644 (file)
@@ -282,8 +282,12 @@ int jtag_call_event_callbacks(enum jtag_event event)
 
        while (callback)
        {
+               jtag_event_callback_t *next;
+
+               /* callback may remove itself */
+               next = callback->next;
                callback->callback(event, callback->priv);
-               callback = callback->next;
+               callback = next;
        }
 
        return ERROR_OK;