pidgin: 226af710: Fix another scenario where a NULL callba...
datallah at pidgin.im
datallah at pidgin.im
Tue Mar 25 20:20:38 EDT 2008
-----------------------------------------------------------------
Revision: 226af7101c9fd3ae43d1a19b9b6d3dcbad249828
Ancestor: ca7cee77a367b0e5214452c04c708e14bfb9d301
Author: datallah at pidgin.im
Date: 2008-03-26T00:18:15
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/226af7101c9fd3ae43d1a19b9b6d3dcbad249828
Modified files:
pidgin/gtkutils.c
ChangeLog:
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.
-------------- next part --------------
============================================================
--- pidgin/gtkutils.c fdb7a916c4abfa38287eee66b1e4703f3f9fa4ac
+++ pidgin/gtkutils.c d3e154b02a687731889ad0f4e7ad296cb02ec812
@@ -2956,8 +2956,9 @@ static void connection_signed_off_cb(Pur
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 @@ pidgin_make_mini_dialog(PurpleConnection
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);
More information about the Commits
mailing list