[mutter] window-actor: Clean up finalization code with simple uses of g_clear_pointer
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] window-actor: Clean up finalization code with simple uses of g_clear_pointer
- Date: Fri, 18 Jan 2013 05:29:24 +0000 (UTC)
commit 079dd60e3d5cd6a6e1070f89f4f7277423bda727
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Jan 14 21:37:11 2013 -0500
window-actor: Clean up finalization code with simple uses of g_clear_pointer
While not a massive change by itself, adding new code to use g_clear_pointer
without porting existing usage looks strange.
https://bugzilla.gnome.org/show_bug.cgi?id=679901
src/compositor/meta-window-actor.c | 36 ++++++------------------------------
1 files changed, 6 insertions(+), 30 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 27ee398..5013a0f 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -388,29 +388,10 @@ meta_window_actor_dispose (GObject *object)
meta_window_actor_clear_bounding_region (self);
meta_window_actor_clear_shadow_clip (self);
- if (priv->shadow_class != NULL)
- {
- g_free (priv->shadow_class);
- priv->shadow_class = NULL;
- }
-
- if (priv->focused_shadow != NULL)
- {
- meta_shadow_unref (priv->focused_shadow);
- priv->focused_shadow = NULL;
- }
-
- if (priv->unfocused_shadow != NULL)
- {
- meta_shadow_unref (priv->unfocused_shadow);
- priv->unfocused_shadow = NULL;
- }
-
- if (priv->shadow_shape != NULL)
- {
- meta_window_shape_unref (priv->shadow_shape);
- priv->shadow_shape = NULL;
- }
+ g_clear_pointer (&priv->shadow_class, g_free);
+ g_clear_pointer (&priv->focused_shadow, meta_shadow_unref);
+ g_clear_pointer (&priv->unfocused_shadow, meta_shadow_unref);
+ g_clear_pointer (&priv->shadow_shape, meta_window_shape_unref);
if (priv->damage != None)
{
@@ -423,17 +404,12 @@ meta_window_actor_dispose (GObject *object)
info->windows = g_list_remove (info->windows, (gconstpointer) self);
- if (priv->window)
- {
- g_object_unref (priv->window);
- priv->window = NULL;
- }
+ g_clear_object (&priv->window);
/*
* Release the extra reference we took on the actor.
*/
- g_object_unref (priv->actor);
- priv->actor = NULL;
+ g_clear_object (&priv->actor);
G_OBJECT_CLASS (meta_window_actor_parent_class)->dispose (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]