[Xfce4-commits] <tumbler:master> Add some additional debug checks.

Nick Schermer noreply at xfce.org
Sun May 5 12:20:02 CEST 2013


Updating branch refs/heads/master
         to a9c038264712a58b38981bdb0aa2d0a672017b18 (commit)
       from bd98846ce8b5b318004a8cac4fbcff23efb59865 (commit)

commit a9c038264712a58b38981bdb0aa2d0a672017b18
Author: Nick Schermer <nick at xfce.org>
Date:   Sat May 4 16:53:26 2013 +0200

    Add some additional debug checks.

 tumbler/tumbler-thumbnailer.c |    3 +++
 tumblerd/tumbler-registry.c   |   12 ++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tumbler/tumbler-thumbnailer.c b/tumbler/tumbler-thumbnailer.c
index 14e2b71..213c8c5 100644
--- a/tumbler/tumbler-thumbnailer.c
+++ b/tumbler/tumbler-thumbnailer.c
@@ -245,6 +245,9 @@ tumbler_thumbnailer_supports_location (TumblerThumbnailer *thumbnailer,
   GSList   *locations, *lp;
   gboolean  supported = FALSE;
 
+  g_return_val_if_fail (TUMBLER_IS_THUMBNAILER (thumbnailer), FALSE);
+  g_return_val_if_fail (G_IS_FILE (file), FALSE);
+
   /* we're cool if no locations are set */
   g_object_get (thumbnailer, "locations", &locations, NULL);
   if (locations == NULL)
diff --git a/tumblerd/tumbler-registry.c b/tumblerd/tumbler-registry.c
index 61739ac..1a2e02b 100644
--- a/tumblerd/tumbler-registry.c
+++ b/tumblerd/tumbler-registry.c
@@ -274,13 +274,19 @@ tumbler_registry_lookup (TumblerRegistry *registry,
 
   thumbnailer = g_hash_table_lookup (registry->preferred_thumbnailers, hash_key);
   if (thumbnailer != NULL)
-    available = g_list_prepend (available, g_object_ref (thumbnailer));
+    {
+      g_return_val_if_fail (TUMBLER_IS_THUMBNAILER (available), NULL);
+      available = g_list_prepend (available, g_object_ref (thumbnailer));
+    }
 
   list = g_hash_table_lookup (registry->thumbnailers, hash_key);
   if (list != NULL)
     {
       for (lp = *list; lp != NULL; lp = lp->next)
-        available = g_list_prepend (available, g_object_ref (lp->data));
+        {
+          g_return_val_if_fail (TUMBLER_IS_THUMBNAILER (lp->data), NULL);
+          available = g_list_prepend (available, g_object_ref (lp->data));
+        }
     }
 
   return g_list_reverse (available);
@@ -294,6 +300,8 @@ tumbler_registry_get_file_size (GFile *gfile)
   GFileInfo *file_info;
   gint64     size = 0;
 
+  g_return_val_if_fail (G_IS_FILE (gfile), 0);
+
   file_info = g_file_query_info (gfile,
                                  G_FILE_ATTRIBUTE_STANDARD_SIZE,
                                  G_FILE_QUERY_INFO_NONE, NULL, NULL);


More information about the Xfce4-commits mailing list