From: Jose Dapena Paz Date: Wed, 2 Jul 2008 21:01:53 +0000 (+0000) Subject: * src/widgets/modest-gtkhtml-msg-view.c: X-Git-Tag: git_migration_finished~1278 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=8ad05e09773c9b7b7e867f81120058b37a626ebf * src/widgets/modest-gtkhtml-msg-view.c: * Reference leak on setting the body to the mime part view. * src/widgets/modest-gtkhtml-mime-part-view.c: * Free mime part reference on dispose. pmo-trunk-r4872 --- diff --git a/src/widgets/modest-gtkhtml-mime-part-view.c b/src/widgets/modest-gtkhtml-mime-part-view.c index 22c60cd..824021f 100644 --- a/src/widgets/modest-gtkhtml-mime-part-view.c +++ b/src/widgets/modest-gtkhtml-mime-part-view.c @@ -51,6 +51,7 @@ static void modest_zoomable_init (gpointer g, gpointer if static void modest_isearch_view_init (gpointer g, gpointer iface_data); static void modest_gtkhtml_mime_part_view_init (ModestGtkhtmlMimePartView *self); static void modest_gtkhtml_mime_part_view_finalize (GObject *self); +static void modest_gtkhtml_mime_part_view_dispose (GObject *self); /* GtkHTML signal handlers */ static gboolean on_link_clicked (GtkWidget *widget, const gchar *uri, ModestGtkhtmlMimePartView *self); @@ -204,6 +205,7 @@ modest_gtkhtml_mime_part_view_class_init (ModestGtkhtmlMimePartViewClass *klass) gobject_class = (GObjectClass*) klass; parent_class = g_type_class_peek_parent (klass); + gobject_class->dispose = modest_gtkhtml_mime_part_view_dispose; gobject_class->finalize = modest_gtkhtml_mime_part_view_finalize; klass->get_part_func = modest_gtkhtml_mime_part_view_get_part_default; @@ -255,6 +257,19 @@ modest_gtkhtml_mime_part_view_finalize (GObject *obj) G_OBJECT_CLASS (parent_class)->finalize (obj); } +static void +modest_gtkhtml_mime_part_view_dispose (GObject *obj) +{ + ModestGtkhtmlMimePartViewPrivate *priv = MODEST_GTKHTML_MIME_PART_VIEW_GET_PRIVATE (obj); + + if (priv->part) { + g_object_unref (priv->part); + priv->part = NULL; + } + + G_OBJECT_CLASS (parent_class)->dispose (obj); +} + /* GTKHTML SIGNALS HANDLERS */ static gboolean diff --git a/src/widgets/modest-gtkhtml-msg-view.c b/src/widgets/modest-gtkhtml-msg-view.c index ef7ee44..2fd7120 100644 --- a/src/widgets/modest-gtkhtml-msg-view.c +++ b/src/widgets/modest-gtkhtml-msg-view.c @@ -1551,6 +1551,7 @@ set_message (ModestGtkhtmlMsgView *self, TnyMsg *msg) body = modest_tny_msg_find_body_part (msg, TRUE); if (body) { tny_mime_part_view_set_part (TNY_MIME_PART_VIEW (priv->body_view), body); + g_object_unref (body); if(modest_attachments_view_has_attachments (MODEST_ATTACHMENTS_VIEW (priv->attachments_view))) { gtk_widget_show_all (priv->attachments_box);