After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 768119 - Fix fallout from get_supported_schemes() changes
Fix fallout from get_supported_schemes() changes
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2016-06-28 01:50 UTC by Florian Müllner
Modified: 2016-06-28 14:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
vfs: Fix return value of get_supported_uri_schemes() (952 bytes, patch)
2016-06-28 01:50 UTC, Florian Müllner
committed Details | Review
vfs: Fix copying default schemes list (1.39 KB, patch)
2016-06-28 01:50 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2016-06-28 01:50:19 UTC
See patches.

Fixes crashes in anything using GtkPlacesSidebar (and likely many other users), plus a rather unimpressive scheme list of "file,resource" ...
Comment 1 Florian Müllner 2016-06-28 01:50:27 UTC
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.
Comment 2 Florian Müllner 2016-06-28 01:50:34 UTC
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.
Comment 3 Matthias Clasen 2016-06-28 03:27:46 UTC
Review of attachment 330465 [details] [review]:

Would be great to have a testcase that exercises this function, with and without registering a custom handler.
Comment 4 Matthias Clasen 2016-06-28 03:28:34 UTC
Review of attachment 330466 [details] [review]:

ok
Comment 5 Florian Müllner 2016-06-28 09:31:25 UTC
(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);
Comment 6 Florian Müllner 2016-06-28 14:08:46 UTC
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