mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-18 19:51:57 +02:00
vfs: Fix copying default schemes list
The list of supported schemes is not known at compile-time, so it is wrong to iterate the list with G_N_ELEMENTS() and we miss all but the first scheme. Fix by checking for the %NULL sentinel instead. https://bugzilla.gnome.org/show_bug.cgi?id=768119
This commit is contained in:
parent
a42bdecf5c
commit
61c1e2db99
@ -276,15 +276,14 @@ g_vfs_get_supported_uri_schemes (GVfs *vfs)
|
|||||||
const char *additional_scheme;
|
const char *additional_scheme;
|
||||||
GPtrArray *supported_schemes;
|
GPtrArray *supported_schemes;
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
int idx;
|
|
||||||
|
|
||||||
class = G_VFS_GET_CLASS (vfs);
|
class = G_VFS_GET_CLASS (vfs);
|
||||||
|
|
||||||
default_schemes = (* class->get_supported_uri_schemes) (vfs);
|
default_schemes = (* class->get_supported_uri_schemes) (vfs);
|
||||||
supported_schemes = g_ptr_array_new ();
|
supported_schemes = g_ptr_array_new ();
|
||||||
|
|
||||||
for (idx = 0; idx < G_N_ELEMENTS (default_schemes); idx++)
|
for (; default_schemes && *default_schemes; default_schemes++)
|
||||||
g_ptr_array_add (supported_schemes, (gpointer) default_schemes[idx]);
|
g_ptr_array_add (supported_schemes, (gpointer) *default_schemes);
|
||||||
|
|
||||||
g_rw_lock_reader_lock (&additional_schemes_lock);
|
g_rw_lock_reader_lock (&additional_schemes_lock);
|
||||||
g_hash_table_iter_init (&iter, priv->additional_schemes);
|
g_hash_table_iter_init (&iter, priv->additional_schemes);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user