diff options
author | Hans Petter Jansson <hpj@ximian.com> | 2004-05-04 09:51:20 +0800 |
---|---|---|
committer | Hans Petter <hansp@src.gnome.org> | 2004-05-04 09:51:20 +0800 |
commit | 3fc532ba3c45bfd87b82f095668549de57bee818 (patch) | |
tree | 1d116f9d8819591c7214f58da84cb226eb1c1d93 /addressbook/gui | |
parent | 5e64711ac811e291e81a85c9071ee0270c7a1761 (diff) | |
download | gsoc2013-evolution-3fc532ba3c45bfd87b82f095668549de57bee818.tar.gz gsoc2013-evolution-3fc532ba3c45bfd87b82f095668549de57bee818.tar.zst gsoc2013-evolution-3fc532ba3c45bfd87b82f095668549de57bee818.zip |
Do ref, unref in right order, so the same contact can be set twice without
2004-05-03 Hans Petter Jansson <hpj@ximian.com>
* gui/widgets/e-minicard.c (e_minicard_set_property): Do ref, unref
in right order, so the same contact can be set twice without ill
effects.
(e_minicard_finalize): NULL pointers after unreffing their objects.
svn path=/trunk/; revision=25775
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/widgets/e-minicard.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index e49b162fc1..bffe91e49e 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -288,6 +288,7 @@ e_minicard_set_property (GObject *object, guint prop_id, const GValue *value, G { GnomeCanvasItem *item; EMinicard *e_minicard; + EContact *contact; GList *l; item = GNOME_CANVAS_ITEM (object); @@ -338,11 +339,15 @@ e_minicard_set_property (GObject *object, guint prop_id, const GValue *value, G set_has_cursor (e_minicard, g_value_get_boolean (value)); break; case PROP_CONTACT: + contact = E_CONTACT (g_value_get_object (value)); + if (contact) + g_object_ref (contact); + if (e_minicard->contact) g_object_unref (e_minicard->contact); - e_minicard->contact = E_CONTACT(g_value_get_object (value)); - if (e_minicard->contact) - g_object_ref (e_minicard->contact); + + e_minicard->contact = contact; + remodel(e_minicard); e_canvas_item_request_reflow(item); e_minicard->changed = FALSE; @@ -425,11 +430,15 @@ e_minicard_finalize (GObject *object) e_minicard = E_MINICARD (object); - if (e_minicard->contact) + if (e_minicard->contact) { g_object_unref (e_minicard->contact); + e_minicard->contact = NULL; + } - if (e_minicard->list_icon_pixbuf) + if (e_minicard->list_icon_pixbuf) { g_object_unref (e_minicard->list_icon_pixbuf); + e_minicard->list_icon_pixbuf = NULL; + } if (G_OBJECT_CLASS (parent_class)->finalize) (* G_OBJECT_CLASS (parent_class)->finalize) (object); |