diff -r ba76659ea73e -r d1cc97d667a2 pidgin/gtkwebview.c --- a/pidgin/gtkwebview.c Thu Mar 27 18:18:58 2014 +0100 +++ b/pidgin/gtkwebview.c Mon Mar 31 14:22:06 2014 +0530 @@ -86,6 +86,7 @@ } PidginWebViewProtocol; struct _PidginWebViewSmiley { + gint box_count; gchar *smile; gchar *file; GdkPixbufAnimation *icon; @@ -674,6 +675,44 @@ g_free(unescaped); } +/************************************************************************** + * PidginWebViewSmiley GBoxed code + **************************************************************************/ + +static PidginWebViewSmiley * +pidgin_webview_smiley_ref(PidginWebViewSmiley *smiley) +{ + g_return_val_if_fail(smiley != NULL, NULL); + + smiley->box_count++; + + return smiley; +} + +static void +pidgin_webview_smiley_unref(PidginWebViewSmiley *smiley) +{ + g_return_if_fail(smiley != NULL); + g_return_if_fail(smiley->box_count >= 0); + + if (!smiley->box_count--) + pidgin_webview_smiley_destroy(smiley); +} + +GType +pidgin_webview_smiley_get_type(void) +{ + static GType type = 0; + + if (type == 0) { + type = g_boxed_type_register_static("PidginWebViewSmiley", + (GBoxedCopyFunc)pidgin_webview_smiley_ref, + (GBoxedFreeFunc)pidgin_webview_smiley_unref); + } + + return type; +} + /****************************************************************************** * Helpers *****************************************************************************/