From 0d327d6fc33813fcc06ae52b10cb74c7b0421acd Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Wed, 5 Apr 2000 01:21:28 +0000 Subject: Fixed some referencing and lifetime issues. 2000-04-04 Christopher James Lahey * widgets/e-minicard/e-minicard.c: Fixed some referencing and lifetime issues. From widgets/e-table: 2000-04-04 Christopher James Lahey * e-table-text-model.c: Make this assert a bit more readable. * e-table-item.c: Fix update loop behavior. svn path=/trunk/; revision=2291 --- addressbook/gui/minicard/e-minicard.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'addressbook/gui/minicard/e-minicard.c') diff --git a/addressbook/gui/minicard/e-minicard.c b/addressbook/gui/minicard/e-minicard.c index b7b9a4c10e..2a98a574c7 100644 --- a/addressbook/gui/minicard/e-minicard.c +++ b/addressbook/gui/minicard/e-minicard.c @@ -32,6 +32,7 @@ static void e_minicard_init (EMinicard *card); static void e_minicard_class_init (EMinicardClass *klass); static void e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); static void e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void e_minicard_destroy (GtkObject *object); static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event); static void e_minicard_realize (GnomeCanvasItem *item); static void e_minicard_unrealize (GnomeCanvasItem *item); @@ -104,7 +105,7 @@ e_minicard_class_init (EMinicardClass *klass) object_class->set_arg = e_minicard_set_arg; object_class->get_arg = e_minicard_get_arg; - /* object_class->destroy = e_minicard_destroy; */ + object_class->destroy = e_minicard_destroy; /* GnomeCanvasItem method overrides */ item_class->realize = e_minicard_realize; @@ -168,7 +169,11 @@ e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) gnome_canvas_item_request_update (item);*/ break; case ARG_MODEL: + if (e_minicard->model) + gtk_object_unref (e_minicard->model); e_minicard->model = E_TABLE_MODEL(GTK_VALUE_OBJECT (*arg)); + if (e_minicard->model) + gtk_object_ref (e_minicard->model); remodel(e_minicard); e_canvas_item_request_reflow(item); break; @@ -212,6 +217,23 @@ e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) } } +static void +e_minicard_destroy (GtkObject *object) +{ + EMinicard *e_minicard; + + g_return_if_fail (object != NULL); + g_return_if_fail (E_IS_MINICARD (object)); + + e_minicard = E_MINICARD (object); + + if (e_minicard->model) + gtk_object_unref (e_minicard->model); + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); +} + static void e_minicard_realize (GnomeCanvasItem *item) { -- cgit