[gnome-shell] Fixes for dispose and finalize
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Fixes for dispose and finalize
- Date: Thu, 11 Mar 2010 20:09:33 +0000 (UTC)
commit 163b2d040361b15420bec152655b6a57a514ab1f
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Wed Mar 10 18:22:06 2010 -0500
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
src/shell-app.c | 2 ++
src/shell-generic-container.c | 12 ++++++++++++
src/st/st-drawing-area.c | 2 ++
src/st/st-entry.c | 4 ++++
src/st/st-im-text.c | 2 ++
src/st/st-label.c | 6 +++---
6 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/src/shell-app.c b/src/shell-app.c
index 992ad8b..7630cd0 100644
--- a/src/shell-app.c
+++ b/src/shell-app.c
@@ -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
diff --git a/src/shell-generic-container.c b/src/shell-generic-container.c
index ad34fee..16b285d 100644
--- a/src/shell-generic-container.c
+++ b/src/shell-generic-container.c
@@ -229,12 +229,24 @@ shell_generic_container_finalize (GObject *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)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (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;
diff --git a/src/st/st-drawing-area.c b/src/st/st-drawing-area.c
index 720c400..7115655 100644
--- a/src/st/st-drawing-area.c
+++ b/src/st/st-drawing-area.c
@@ -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
diff --git a/src/st/st-entry.c b/src/st/st-entry.c
index fa10489..147640d 100644
--- a/src/st/st-entry.c
+++ b/src/st/st-entry.c
@@ -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
diff --git a/src/st/st-im-text.c b/src/st/st-im-text.c
index aa94b40..29fd71e 100644
--- a/src/st/st-im-text.c
+++ b/src/st/st-im-text.c
@@ -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
diff --git a/src/st/st-label.c b/src/st/st-label.c
index 1a304a4..0b6a9fd 100644
--- a/src/st/st-label.c
+++ b/src/st/st-label.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]