soc.2009.webkitmessageview: c2e72a7e: Cleanly handle webkit destroy events.

tdrhq at soc.pidgin.im tdrhq at soc.pidgin.im
Tue Aug 25 12:04:17 EDT 2009


-----------------------------------------------------------------
Revision: c2e72a7e918bf0346ab6b72adbb0b919c6d3d1dd
Ancestor: 16fbaa5c4b421c20b7512597eb0c9e91e8b6abb5
Author: tdrhq at soc.pidgin.im
Date: 2009-08-10T05:56:08
Branch: im.pidgin.soc.2009.webkitmessageview
URL: http://d.pidgin.im/viewmtn/revision/info/c2e72a7e918bf0346ab6b72adbb0b919c6d3d1dd

Modified files:
        pidgin/plugins/adiumthemes/webkit.c

ChangeLog: 

Cleanly handle webkit destroy events.

-------------- next part --------------
============================================================
--- pidgin/plugins/adiumthemes/webkit.c	48d710f8f4ba9fb1a46eb883aa6cf09dd2ce9aed
+++ pidgin/plugins/adiumthemes/webkit.c	af9afabb36a40ef4ea56624f2ca518e6f4cf0159
@@ -122,6 +122,7 @@ static void variant_set_default (PidginM
 }
 
 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 @@ init_theme_for_webkit (PurpleConversatio
 
 	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 @@ finalize_theme_for_webkit (PurpleConvers
 	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;


More information about the Commits mailing list