[glib] vfs: Fix return value of get_supported_uri_schemes()



commit a42bdecf5cedfcfc376d4694e66ac7a767b8c8b1
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Jun 28 01:58:13 2016 +0200

    vfs: Fix return value of get_supported_uri_schemes()
    
    The function is expected to return a %NULL-terminated array, but
    commit 375b4ca65c dropped the sentinel when adding support for
    additional custom schemes. Add it back.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768119

 gio/gvfs.c      |    2 ++
 gio/tests/vfs.c |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gio/gvfs.c b/gio/gvfs.c
index eed723b..2fdb0a8 100644
--- a/gio/gvfs.c
+++ b/gio/gvfs.c
@@ -295,6 +295,8 @@ g_vfs_get_supported_uri_schemes (GVfs *vfs)
 
       g_rw_lock_reader_unlock (&additional_schemes_lock);
 
+      g_ptr_array_add (supported_schemes, NULL);
+
       g_free (priv->supported_schemes);
       priv->supported_schemes =
         (char const **) g_ptr_array_free (supported_schemes, FALSE);
diff --git a/gio/tests/vfs.c b/gio/tests/vfs.c
index 67e33bd..b8a850d 100644
--- a/gio/tests/vfs.c
+++ b/gio/tests/vfs.c
@@ -63,6 +63,9 @@ test_register_scheme (void)
   g_assert_nonnull (vfs);
   g_assert_true (g_vfs_is_active (vfs));
 
+  schemes = g_vfs_get_supported_uri_schemes (vfs);
+  g_assert_false (g_strv_contains (schemes, "test"));
+
   res = g_vfs_unregister_uri_scheme (vfs, "test");
   g_assert_false (res);
 


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