The updated attached patch makes "remove_txbuttons_cb()" and
"remove_rx_icon_cb()" safer: they can be called any number of times.
Should not make a real difference, when the call-back functions are called
once or not at all (because the callbacks have been removed).
To apply to Debian/testing (squeeze):
For the impatient the dummy install guide:
Copy the attached "pidgin-encryption-3.0-7.diff" to /tmp
cd /tmp
apt-get source pidgin-encryption
cd pidgin-encryption-3.0/
patch -p1 <../pidgin-encryption-3.0-7.diff
dpkg-buildpackage
and as root "dpkg -i [the new package in /tmp]"
Hans
--- pidgin-encryption-3.0/state_ui.c 2010-02-16 21:26:48.000000000 +0100
+++ pidgin-encryption-3.0-7/state_ui.c 2010-02-17 22:06:21.000000000 +0100
@@ -154,13 +154,20 @@
static void remove_txbuttons_cb( GtkWidget *widget, gpointer data ) {
purple_debug(PURPLE_DEBUG_INFO, "pidgin-encryption",
"Got callback for destroyed window %p %p\n", data, widget);
+
+ if (tx_encrypt_menus != NULL) {
g_hash_table_remove(tx_encrypt_menus, data);
+ tx_encrypt_menus = NULL;
+ }
}
static void remove_rx_icon_cb( GtkWidget *widget, gpointer data ) {
purple_debug(PURPLE_DEBUG_INFO, "pidgin-encryption",
"Got callback for destroyed window %p %p\n", data, widget);
+ if (rx_encrypt_iconlist != NULL) {
g_hash_table_remove(rx_encrypt_iconlist, data);
+ rx_encrypt_iconlist = NULL;
+ }
}
void PE_state_ui_init() {
@@ -176,7 +183,13 @@
g_hash_table_destroy(tx_encrypt_menus);
g_hash_table_destroy(rx_encrypt_iconlist);
+ tx_encrypt_menus = NULL;
+ rx_encrypt_iconlist = NULL;
+
g_free(smiley_filepath);
+ smiley_filepath = NULL;
+
+ purple_debug(PURPLE_DEBUG_INFO, "pidgin-encryption","PE_state_ui_delete() done");
}
void PE_set_tx_encryption_icon(PurpleConversation* conv,
@@ -388,6 +401,11 @@
win = pidgin_conv_get_window(gtkconv);
g_return_if_fail(win != NULL);
+ /* Remove the destroy callbacks */
+ g_signal_handlers_disconnect_by_func(G_OBJECT(win->window), G_CALLBACK(remove_txbuttons_cb), win);
+ g_signal_handlers_disconnect_by_func(G_OBJECT(win->window), G_CALLBACK(remove_rx_icon_cb), win);
+ purple_debug(PURPLE_DEBUG_INFO, "pidgin-encryption","PE_remove_decorations(): Removed the destroy callbacks");
+
tx_menubuttons = g_hash_table_lookup(tx_encrypt_menus, win);
if (tx_menubuttons) {
gtk_widget_destroy(tx_menubuttons->unencrypted);