im.pidgin.cpw.resiak.disconnectreason: 4dd3fd798c2196a1e6c84a1044a2c47f3ff7356f
resiak at soc.pidgin.im
resiak at soc.pidgin.im
Mon Nov 5 04:40:50 EST 2007
-----------------------------------------------------------------
Revision: 4dd3fd798c2196a1e6c84a1044a2c47f3ff7356f
Ancestor: fd3990c761b42aa1c32267adb7908e5ce0adf7f0
Author: resiak at soc.pidgin.im
Date: 2007-11-04T23:56:25
Branch: im.pidgin.cpw.resiak.disconnectreason
Modified files:
pidgin/gtkutils.c
ChangeLog:
Don't leak all bar one of the closure structs allocated by
pidgin_make_mini_dialog().
-------------- next part --------------
============================================================
--- pidgin/gtkutils.c f660834f5f1188a73ad943aac1b326b2db71c09c
+++ pidgin/gtkutils.c ade93310415efb3cab148ef2212ec167c714b6ca
@@ -2922,9 +2922,19 @@ old_mini_dialog_button_clicked_cb(Pidgin
{
struct _old_button_clicked_cb_data *data = user_data;
data->cb(data->data, button);
- g_free(data);
}
+static void
+old_mini_dialog_destroy_cb(GtkWidget *dialog,
+ GList *cb_datas)
+{
+ while (cb_datas != NULL)
+ {
+ g_free(cb_datas->data);
+ cb_datas = g_list_delete_link(cb_datas, cb_datas);
+ }
+}
+
GtkWidget *
pidgin_make_mini_dialog(PurpleConnection *gc,
const char *icon_name,
@@ -2935,6 +2945,7 @@ pidgin_make_mini_dialog(PurpleConnection
{
PidginMiniDialog *mini_dialog;
const char *button_text;
+ GList *cb_datas = NULL;
va_list args;
static gboolean first_call = TRUE;
@@ -2960,9 +2971,13 @@ pidgin_make_mini_dialog(PurpleConnection
data->data = user_data;
pidgin_mini_dialog_add_button(mini_dialog, button_text,
old_mini_dialog_button_clicked_cb, data);
+ cb_datas = g_list_append(cb_datas, data);
}
va_end(args);
+ g_signal_connect(G_OBJECT(mini_dialog), "destroy",
+ G_CALLBACK(old_mini_dialog_destroy_cb), cb_datas);
+
return GTK_WIDGET(mini_dialog);
}
More information about the Commits
mailing list