aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2012-09-08 18:08:22 +0800
committerXan Lopez <xan@igalia.com>2012-09-08 18:08:22 +0800
commit1ba7ab5e529d93f8913b4b89f13f9f24fd715761 (patch)
tree32d3cf6d62058999e97c3eec75aa37c2722b6caa
parent8257cf80b4f63b44b995fa090a66e361dc35629d (diff)
downloadgsoc2013-epiphany-1ba7ab5e529d93f8913b4b89f13f9f24fd715761.tar.gz
gsoc2013-epiphany-1ba7ab5e529d93f8913b4b89f13f9f24fd715761.tar.zst
gsoc2013-epiphany-1ba7ab5e529d93f8913b4b89f13f9f24fd715761.zip
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).
-rw-r--r--embed/ephy-embed-shell.c47
1 files changed, 7 insertions, 40 deletions
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 9e31af830..2ddbd4fd7 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);
}