changeset 8090:fb0eab758560

[gaim-migrate @ 8789] Thanks to Ben Herrenschmidt for pointing this out. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Tue, 13 Jan 2004 02:15:46 +0000
parents 35db601609e3
children 56b74730715f
files src/signals.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/signals.c	Tue Jan 13 01:45:32 2004 +0000
+++ b/src/signals.c	Tue Jan 13 02:15:46 2004 +0000
@@ -415,6 +415,7 @@
 	GaimSignalData *signal_data;
 	GaimSignalHandlerData *handler_data;
 	GList *l, *l_next;
+	va_list tmp;
 
 	g_return_if_fail(instance != NULL);
 	g_return_if_fail(signal   != NULL);
@@ -440,16 +441,22 @@
 
 		handler_data = (GaimSignalHandlerData *)l->data;
 
+		/* This is necessary because a va_list may only be
+		 * evaluated once */
+		va_copy(tmp, args);
+
 		if (handler_data->use_vargs)
 		{
-			((void (*)(va_list, void *))handler_data->cb)(args,
+			((void (*)(va_list, void *))handler_data->cb)(tmp,
 														  handler_data->data);
 		}
 		else
 		{
-			signal_data->marshal(handler_data->cb, args,
+			signal_data->marshal(handler_data->cb, tmp,
 								 handler_data->data, NULL);
 		}
+
+		va_end(tmp);
 	}
 }