[grilo-plugins] all: Do not leak icon



commit 242114989f0a2308539a9b60d262c8fe9b9d0628
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Sun Mar 9 00:36:22 2014 +0000

    all: Do not leak icon

 src/apple-trailers/grl-apple-trailers.c |    1 +
 src/bliptv/grl-bliptv.c                 |   18 +++++++++++-------
 src/freebox/grl-freebox.c               |    2 ++
 src/lua-factory/grl-lua-factory.c       |    1 +
 src/pocket/grl-pocket.c                 |    1 +
 src/raitv/grl-raitv.c                   |   18 +++++++++++-------
 src/upnp/grl-upnp.c                     |    1 +
 src/vimeo/grl-vimeo.c                   |   18 +++++++++++-------
 src/youtube/grl-youtube.c               |    1 +
 9 files changed, 40 insertions(+), 21 deletions(-)
---
diff --git a/src/apple-trailers/grl-apple-trailers.c b/src/apple-trailers/grl-apple-trailers.c
index 6778118..7212093 100644
--- a/src/apple-trailers/grl-apple-trailers.c
+++ b/src/apple-trailers/grl-apple-trailers.c
@@ -182,6 +182,7 @@ grl_apple_trailers_source_new (gboolean high_definition,
                          "source-icon", icon,
                          "source-tags", tags,
                          NULL);
+  g_object_unref (icon);
 
   return source;
 }
diff --git a/src/bliptv/grl-bliptv.c b/src/bliptv/grl-bliptv.c
index 6a5d3db..1b410d3 100644
--- a/src/bliptv/grl-bliptv.c
+++ b/src/bliptv/grl-bliptv.c
@@ -151,17 +151,21 @@ grl_bliptv_source_new (void)
 {
   GIcon *icon;
   GFile *file;
+  GrlBliptvSource *source;
 
   file = g_file_new_for_uri ("resource:///org/gnome/grilo/plugins/bliptv/channel-bliptv.svg");
   icon = g_file_icon_new (file);
   g_object_unref (file);
-  return g_object_new (GRL_TYPE_BLIPTV_SOURCE,
-                       "source-id", SOURCE_ID,
-                       "source-name", SOURCE_NAME,
-                       "source-desc", SOURCE_DESC,
-                       "supported-media", GRL_MEDIA_TYPE_VIDEO,
-                       "source-icon", icon,
-                       NULL);
+  source = g_object_new (GRL_TYPE_BLIPTV_SOURCE,
+                         "source-id", SOURCE_ID,
+                         "source-name", SOURCE_NAME,
+                         "source-desc", SOURCE_DESC,
+                         "supported-media", GRL_MEDIA_TYPE_VIDEO,
+                         "source-icon", icon,
+                         NULL);
+  g_object_unref (icon);
+
+  return source;
 }
 
 static void
diff --git a/src/freebox/grl-freebox.c b/src/freebox/grl-freebox.c
index cfc53f2..ac09623 100644
--- a/src/freebox/grl-freebox.c
+++ b/src/freebox/grl-freebox.c
@@ -182,6 +182,8 @@ grl_freebox_source_new (void)
                          "source-icon", icon,
                          "source-tags", tags,
                          NULL);
+  g_object_unref (icon);
+
   return object;
 }
 
diff --git a/src/lua-factory/grl-lua-factory.c b/src/lua-factory/grl-lua-factory.c
index 781224d..e0f84fe 100644
--- a/src/lua-factory/grl-lua-factory.c
+++ b/src/lua-factory/grl-lua-factory.c
@@ -257,6 +257,7 @@ grl_lua_factory_source_new (gchar *lua_plugin_path,
   g_free (source_name);
   g_free (source_desc);
   g_clear_pointer (&source_tags, g_strfreev);
+  g_clear_object (&source_icon);
 
   ret = lua_plugin_source_operations (L, source->priv->fn);
   if (ret != LUA_OK)
diff --git a/src/pocket/grl-pocket.c b/src/pocket/grl-pocket.c
index fb514bb..9f76102 100644
--- a/src/pocket/grl-pocket.c
+++ b/src/pocket/grl-pocket.c
@@ -194,6 +194,7 @@ grl_pocket_source_new (GnomePocket *pocket)
                          "supported-media", GRL_MEDIA_TYPE_VIDEO,
                          "source-icon", icon,
                          NULL);
+  g_object_unref (icon);
   GRL_POCKET_SOURCE (object)->priv->pocket = pocket;
 
   return object;
diff --git a/src/raitv/grl-raitv.c b/src/raitv/grl-raitv.c
index f0ddc3b..83c2f7f 100644
--- a/src/raitv/grl-raitv.c
+++ b/src/raitv/grl-raitv.c
@@ -260,17 +260,21 @@ grl_raitv_source_new (void)
 {
   GIcon *icon;
   GFile *file;
+  GrlRaitvSource *source;
 
   file = g_file_new_for_uri ("resource:///org/gnome/grilo/plugins/raitv/channel-rai.svg");
   icon = g_file_icon_new (file);
   g_object_unref (file);
-  return g_object_new (GRL_TYPE_RAITV_SOURCE,
-                       "source-id", SOURCE_ID,
-                       "source-name", SOURCE_NAME,
-                       "source-desc", SOURCE_DESC,
-                       "supported-media", GRL_MEDIA_TYPE_VIDEO,
-                       "source-icon", icon,
-                       NULL);
+  source = g_object_new (GRL_TYPE_RAITV_SOURCE,
+                         "source-id", SOURCE_ID,
+                         "source-name", SOURCE_NAME,
+                         "source-desc", SOURCE_DESC,
+                         "supported-media", GRL_MEDIA_TYPE_VIDEO,
+                         "source-icon", icon,
+                         NULL);
+  g_object_unref (icon);
+
+  return source;
 }
 
 static void
diff --git a/src/upnp/grl-upnp.c b/src/upnp/grl-upnp.c
index acaecca..fa9a061 100644
--- a/src/upnp/grl-upnp.c
+++ b/src/upnp/grl-upnp.c
@@ -234,6 +234,7 @@ grl_upnp_source_new (const gchar *source_id, const gchar *name, const gchar *ico
   source->priv->upnp_name = g_strdup (name);
 
   g_free (source_desc);
+  g_clear_object (&icon);
 
   return source;
 }
diff --git a/src/vimeo/grl-vimeo.c b/src/vimeo/grl-vimeo.c
index 1f60702..352898b 100644
--- a/src/vimeo/grl-vimeo.c
+++ b/src/vimeo/grl-vimeo.c
@@ -179,6 +179,7 @@ grl_vimeo_source_new (void)
 {
   GIcon *icon;
   GFile *file;
+  GrlVimeoSource *source;
 
   GRL_DEBUG ("grl_vimeo_source_new");
 
@@ -186,13 +187,16 @@ grl_vimeo_source_new (void)
   icon = g_file_icon_new (file);
   g_object_unref (file);
 
-  return g_object_new (GRL_VIMEO_SOURCE_TYPE,
-                       "source-id", SOURCE_ID,
-                       "source-name", SOURCE_NAME,
-                       "source-desc", SOURCE_DESC,
-                       "supported-media", GRL_MEDIA_TYPE_VIDEO,
-                       "source-icon", icon,
-                       NULL);
+  source = g_object_new (GRL_VIMEO_SOURCE_TYPE,
+                         "source-id", SOURCE_ID,
+                         "source-name", SOURCE_NAME,
+                         "source-desc", SOURCE_DESC,
+                         "supported-media", GRL_MEDIA_TYPE_VIDEO,
+                         "source-icon", icon,
+                         NULL);
+  g_object_unref (icon);
+
+  return source;
 }
 
 static void
diff --git a/src/youtube/grl-youtube.c b/src/youtube/grl-youtube.c
index a9dfa7d..eb97dfa 100644
--- a/src/youtube/grl-youtube.c
+++ b/src/youtube/grl-youtube.c
@@ -350,6 +350,7 @@ grl_youtube_source_new (const gchar *api_key, const gchar *client_id, const gcha
                                              "source-icon", icon,
                                             NULL));
 
+  g_object_unref (icon);
   ytsrc = source;
   g_object_add_weak_pointer (G_OBJECT (source), (gpointer *) &ytsrc);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]