GNOME Bugzilla – Bug 768119
Fix fallout from get_supported_schemes() changes
Last modified: 2016-06-28 14:08:55 UTC
See patches. Fixes crashes in anything using GtkPlacesSidebar (and likely many other users), plus a rather unimpressive scheme list of "file,resource" ...
Created attachment 330465 [details] [review] 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.
Created attachment 330466 [details] [review] 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.
Review of attachment 330465 [details] [review]: Would be great to have a testcase that exercises this function, with and without registering a custom handler.
Review of attachment 330466 [details] [review]: ok
(In reply to Matthias Clasen from comment #3) > Would be great to have a testcase that exercises this function, with and > without registering a custom handler. Do you mean squashing something like this: 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);
Attachment 330465 [details] pushed as a42bdec - vfs: Fix return value of get_supported_uri_schemes() Attachment 330466 [details] pushed as 61c1e2d - vfs: Fix copying default schemes list