besser82 / rpms / pidgin

Forked from rpms/pidgin 6 years ago
Clone
Blob Blame History Raw
http://developer.pidgin.im/viewmtn/revision/info/633ffe234af48ead3631ae62e23840b4438fcf5f
Don't try to remove GtkIMHtmlSmileys from smiley trees if the GtkIMHtml
that the smiley refers to doesn't exist anymore.
Yes, I know this is a bit hacky, but I couldn't find another obvious way to do
it without adding stuff in gtksmiley.c...
http://developer.pidgin.im/viewmtn/revision/info/9a91956125003141d6eb6d89094aa76ae479879a
Remove that hack involving GtkIMHtmlSmileys
Thanks to Sadrul for hinting about the solution

diff -urN pidgin-2.5.2.orig/pidgin/gtkimhtml.c pidgin-2.5.2/pidgin/gtkimhtml.c
--- pidgin-2.5.2.orig/pidgin/gtkimhtml.c	2008-11-21 14:43:49.000000000 -0500
+++ pidgin-2.5.2/pidgin/gtkimhtml.c	2008-11-21 14:48:32.000000000 -0500
@@ -2054,12 +2054,23 @@
 }
 
 static void
+gtk_imhtml_disconnect_smiley(GtkIMHtml *imhtml, GtkIMHtmlSmiley *smiley)
+{
+	smiley->imhtml = NULL;
+	g_signal_handlers_disconnect_matched(imhtml, G_SIGNAL_MATCH_DATA, 0, 0,
+		NULL, NULL, smiley);
+}
+
+static void
 gtk_imhtml_disassociate_smiley(GtkIMHtmlSmiley *smiley)
 {
 	if (smiley->imhtml) {
 		gtk_smiley_tree_remove(smiley->imhtml->default_smilies, smiley);
 		g_hash_table_foreach(smiley->imhtml->smiley_data, 
 			gtk_imhtml_disassociate_smiley_foreach, smiley);
+		g_signal_handlers_disconnect_matched(smiley->imhtml, G_SIGNAL_MATCH_DATA,
+			0, 0, NULL, NULL, smiley);
+		smiley->imhtml = NULL;
 	}
 }
 
@@ -2079,9 +2090,19 @@
 		g_hash_table_insert(imhtml->smiley_data, g_strdup(sml), tree);
 	}
 
+	/* need to disconnect old imhtml, if there is one */
+	if (smiley->imhtml) {
+		g_signal_handlers_disconnect_matched(smiley->imhtml, G_SIGNAL_MATCH_DATA,
+			0, 0, NULL, NULL, smiley);
+	}
+	
 	smiley->imhtml = imhtml;
 
 	gtk_smiley_tree_insert (tree, smiley);
+	
+	/* connect destroy signal for the imhtml */
+	g_signal_connect(imhtml, "destroy", G_CALLBACK(gtk_imhtml_disconnect_smiley), 
+		smiley);
 }
 
 static gboolean
diff -urN pidgin-2.5.2.orig/pidgin/gtkthemes.c pidgin-2.5.2/pidgin/gtkthemes.c
--- pidgin-2.5.2.orig/pidgin/gtkthemes.c	2008-06-12 00:25:39.000000000 -0400
+++ pidgin-2.5.2/pidgin/gtkthemes.c	2008-11-21 14:49:03.000000000 -0500
@@ -169,6 +169,12 @@
 	for (wer = theme->list; wer != NULL; wer = theme->list) {
 		while (wer->smileys) {
 			GtkIMHtmlSmiley *uio = wer->smileys->data;
+			
+			if (uio->imhtml) {
+				g_signal_handlers_disconnect_matched(uio->imhtml, G_SIGNAL_MATCH_DATA,
+					0, 0, NULL, NULL, uio);
+			}
+				
 			if (uio->icon)
 				g_object_unref(uio->icon);
 			if (g_hash_table_lookup(already_freed, uio->file) == NULL) {