From 36031828bab8e5a9a3494d94e49c6b4882cb32f3 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 21 May 2007 07:21:28 +0200 Subject: [PATCH] plugin.c: Added a comment that explains why the order of the linked list and callback are important. --- src/plugin.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugin.c b/src/plugin.c index 8087950e..da662040 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -607,6 +607,11 @@ void plugin_shutdown_all (void) while (le != NULL) { callback = (int (*) (void)) le->value; + + /* Advance the pointer before calling the callback allows + * shutdown functions to unregister themselves. If done the + * other way around the memory `le' points to will be freed + * after callback returns. */ le = le->next; (*callback) (); -- 2.30.2