changeset 32079:7b92a2b852db

Cleanly handle webkit destroy events.
author tdrhq@soc.pidgin.im
date Mon, 10 Aug 2009 05:56:08 +0000
parents 7194ddfc8158
children b89351c7580b
files pidgin/plugins/adiumthemes/webkit.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/plugins/adiumthemes/webkit.c	Mon Aug 10 05:36:10 2009 +0000
+++ b/pidgin/plugins/adiumthemes/webkit.c	Mon Aug 10 05:56:08 2009 +0000
@@ -122,6 +122,7 @@
 }
 
 static void variant_set_default (PidginMessageStyle* style);
+static void webkit_on_webview_destroy (GtkObject* obj, gpointer data);
 
 static PidginMessageStyle*
 pidgin_message_style_load (const char* styledir)
@@ -462,6 +463,8 @@
 
 	g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, style);
 	
+	/* I need to unref this style when the webkit object destroys */
+	g_signal_connect (G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), style);
 
 	g_free (basedir);
 	g_free (baseuri);
@@ -484,6 +487,13 @@
 	pidgin_message_style_unref (style);
 }
 
+static void
+webkit_on_webview_destroy (GtkObject *object, gpointer data)
+{
+	pidgin_message_style_unref ((PidginMessageStyle*) data);
+	g_object_set_data (G_OBJECT(object), MESSAGE_STYLE_KEY, NULL);
+}
+
 struct webkit_script {
 	GtkWidget *webkit;
 	char *script;