Fixes for dispose and finalize

* Add missing chain-up for dispose and finalize methods
* ShellGenericContainer needs to destroy its children in dispose()
* Fix variable naming and excess casts in st_label_dispose()

https://bugzilla.gnome.org/show_bug.cgi?id=612511
This commit is contained in:
Owen W. Taylor 2010-03-10 18:22:06 -05:00
parent c83883f1f7
commit 163b2d0403
6 changed files with 25 additions and 3 deletions

View File

@ -360,6 +360,8 @@ shell_app_dispose (GObject *object)
_shell_app_remove_window (app, app->windows->data);
disconnect_workspace_switch (app);
G_OBJECT_CLASS(shell_app_parent_class)->dispose (object);
}
static void

View File

@ -228,6 +228,17 @@ shell_generic_container_finalize (GObject *object)
G_OBJECT_CLASS (shell_generic_container_parent_class)->finalize (object);
}
static void
shell_generic_container_dispose (GObject *object)
{
ShellGenericContainerPrivate *priv = SHELL_GENERIC_CONTAINER (object)->priv;
while (priv->children)
clutter_actor_destroy (priv->children->data);
G_OBJECT_CLASS (shell_generic_container_parent_class)->dispose (object);
}
static void
shell_generic_container_class_init (ShellGenericContainerClass *klass)
{
@ -235,6 +246,7 @@ shell_generic_container_class_init (ShellGenericContainerClass *klass)
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
gobject_class->finalize = shell_generic_container_finalize;
gobject_class->dispose = shell_generic_container_dispose;
actor_class->get_preferred_width = shell_generic_container_get_preferred_width;
actor_class->get_preferred_height = shell_generic_container_get_preferred_height;

View File

@ -63,6 +63,8 @@ st_drawing_area_dispose (GObject *object)
cogl_handle_unref (priv->texture);
priv->texture = COGL_INVALID_HANDLE;
}
G_OBJECT_CLASS (st_drawing_area_parent_class)->dispose (object);
}
static void

View File

@ -171,6 +171,8 @@ st_entry_dispose (GObject *object)
clutter_actor_destroy (priv->entry);
priv->entry = NULL;
}
G_OBJECT_CLASS (st_entry_parent_class)->dispose (object);
}
static void
@ -180,6 +182,8 @@ st_entry_finalize (GObject *object)
g_free (priv->hint);
priv->hint = NULL;
G_OBJECT_CLASS (st_entry_parent_class)->finalize (object);
}
static void

View File

@ -93,6 +93,8 @@ st_im_text_dispose (GObject *object)
g_object_unref (priv->im_context);
priv->im_context = NULL;
G_OBJECT_CLASS (st_im_text_parent_class)->dispose (object);
}
static void

View File

@ -172,9 +172,9 @@ st_label_allocate (ClutterActor *actor,
}
static void
st_label_dispose (GObject *actor)
st_label_dispose (GObject *object)
{
StLabelPrivate *priv = ST_LABEL (actor)->priv;
StLabelPrivate *priv = ST_LABEL (object)->priv;
if (priv->label)
{
@ -182,7 +182,7 @@ st_label_dispose (GObject *actor)
priv->label = NULL;
}
G_OBJECT_CLASS (st_label_parent_class)->dispose (G_OBJECT (actor));
G_OBJECT_CLASS (st_label_parent_class)->dispose (object);
}
static void