pidgin-encryption/3.0-6 still crashes when an encrypted chat session
window is open on application shutdown.

As pointed out by Paul Aurich ("darkrain") in
  
https://sourceforge.net/tracker/?func=detail&atid=485253&aid=2934709&group_id=57740

this is caused by the destroy callback done after the hash tables have
been deleted.

Call Pidgin with "-d" so it logs debug messages to stdout.
In the 3.0-6 version it logs as the last message:
(21:22:58) pidgin-encryption: Got callback for destroyed window 0x1faf410
0x2098110

Then it apparently crashes.

See attached diff for the fix. (mostly from Paul Aurich)

Remove the "Remove the destroy callbacks" part and it logs both destroy
callbacks. (i.e. twice the message)
Here it does not crash, because I test whether the hash tables are not null.


Hans

(credits to Paul Aurich. He found it)
--- 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-16 21:37:22.000000000 +0100
@@ -154,13 +154,18 @@
 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);
+   }
 }
 
 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);
+   }
 }
 
 void PE_state_ui_init() {
@@ -176,7 +181,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 +399,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);

Reply via email to