# HG changeset patch # User Daniel Atallah # Date 1206490695 0 # Node ID 387024e316d162e7c0e52566e770cc1cab077038 # Parent d56ec4910b6db8cbffda10c814a3e5500908a300 Fix another scenario where a NULL callback can be called. I'm pretty confident this fixes #4901. There's also a fix in here to prevent freed memory from being accessed when removing minidialogs from a signed-off account that I've had sitting on my machine for a while. diff -r d56ec4910b6d -r 387024e316d1 pidgin/gtkutils.c --- a/pidgin/gtkutils.c Tue Mar 25 14:45:48 2008 +0000 +++ b/pidgin/gtkutils.c Wed Mar 26 00:18:15 2008 +0000 @@ -2956,8 +2956,9 @@ static void connection_signed_off_cb(PurpleConnection *gc) { - GSList *list; - for (list = minidialogs; list; list = list->next) { + GSList *list, *l_next; + for (list = minidialogs; list; list = l_next) { + l_next = list->next; if (g_object_get_data(G_OBJECT(list->data), "gc") == gc) { gtk_widget_destroy(GTK_WIDGET(list->data)); } @@ -3023,14 +3024,19 @@ va_start(args, user_data); while ((button_text = va_arg(args, char*))) { + struct _old_button_clicked_cb_data *data = NULL; + PidginMiniDialogCallback wrapper_cb = NULL; PidginUtilMiniDialogCallback callback = va_arg(args, PidginUtilMiniDialogCallback); - struct _old_button_clicked_cb_data *data = - g_new0(struct _old_button_clicked_cb_data, 1); - data->cb = callback; - data->data = user_data; + + if (callback != NULL) { + data = g_new0(struct _old_button_clicked_cb_data, 1); + data->cb = callback; + data->data = user_data; + wrapper_cb = old_mini_dialog_button_clicked_cb; + } pidgin_mini_dialog_add_button(mini_dialog, button_text, - old_mini_dialog_button_clicked_cb, data); + wrapper_cb, data); cb_datas = g_list_append(cb_datas, data); } va_end(args);