[epiphany] ephy-embed-shell: cleanup dispose & finalize
- From: Xan Lopez <xan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] ephy-embed-shell: cleanup dispose & finalize
- Date: Sat, 8 Sep 2012 10:13:16 +0000 (UTC)
commit 1ba7ab5e529d93f8913b4b89f13f9f24fd715761
Author: Xan Lopez <xan igalia com>
Date: Sat Sep 8 12:08:22 2012 +0200
ephy-embed-shell: cleanup dispose & finalize
Unref objects in dispose, not finalize. Use g_clear_object correctly
(no need to check whether the pointer is NULL).
embed/ephy-embed-shell.c | 47 ++++++---------------------------------------
1 files changed, 7 insertions(+), 40 deletions(-)
---
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 9e31af8..2ddbd4f 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -95,27 +95,13 @@ ephy_embed_shell_dispose (GObject *object)
EphyEmbedShell *shell = EPHY_EMBED_SHELL (object);
EphyEmbedShellPrivate *priv = shell->priv;
- if (priv->encodings != NULL)
- {
- LOG ("Unref encodings");
- g_object_unref (priv->encodings);
- priv->encodings = NULL;
- }
-
- if (priv->page_setup != NULL)
- {
- g_object_unref (priv->page_setup);
- priv->page_setup = NULL;
- }
-
- if (priv->print_settings != NULL)
- {
- g_object_unref (priv->print_settings);
- priv->print_settings = NULL;
- }
-
- if (priv->frecent_store != NULL)
- g_clear_object (&priv->frecent_store);
+ g_clear_object (&priv->encodings);
+ g_clear_object (&priv->page_setup);
+ g_clear_object (&priv->print_settings);
+ g_clear_object (&priv->frecent_store);
+ g_clear_object (&priv->global_history_service);
+ g_clear_object (&priv->embed_single);
+ g_clear_object (&priv->adblock_manager);
G_OBJECT_CLASS (ephy_embed_shell_parent_class)->dispose (object);
}
@@ -133,25 +119,6 @@ ephy_embed_shell_finalize (GObject *object)
shell->priv->downloads = NULL;
}
- if (shell->priv->global_history_service)
- {
- LOG ("Unref history service");
- g_object_unref (shell->priv->global_history_service);
- }
-
- if (shell->priv->embed_single)
- {
- LOG ("Unref embed single");
- g_object_unref (G_OBJECT (shell->priv->embed_single));
- }
-
- if (shell->priv->adblock_manager != NULL)
- {
- LOG ("Unref adblock manager");
- g_object_unref (shell->priv->adblock_manager);
- shell->priv->adblock_manager = NULL;
- }
-
G_OBJECT_CLASS (ephy_embed_shell_parent_class)->finalize (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]