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 709456 - Calling g_base_info_get_name on GI_INFO_TYPE_TYPE causes segfault
Calling g_base_info_get_name on GI_INFO_TYPE_TYPE causes segfault
Status: RESOLVED OBSOLETE
Product: gobject-introspection
Classification: Platform
Component: libgirepository
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-10-04 23:45 UTC by Simon Feltman
Modified: 2018-02-08 12:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to gibaseinfo.c (275 bytes, patch)
2014-06-23 21:39 UTC, Adam Stark
none Details | Review

Description Simon Feltman 2013-10-04 23:45:47 UTC
g_base_info_get_name uses a switch statement to dispatch based on the GITypeInfo of the object. In the case of GI_INFO_TYPE_TYPE, it is combined with the default case which uses g_assert_not_reached(). This seems like it breaks the object oriented conceptual model for the classes. I think any valid type should return something (even NULL).

https://git.gnome.org/browse/gobject-introspection/tree/girepository/gibaseinfo.c?h=gnome-3-0#n365
Comment 1 Dieter Verfaillie 2013-10-10 18:16:35 UTC
(In reply to comment #0)
> I think any valid type should return something (even NULL).

g_base_info_get_name is even already documented to return
"or %NULL if it lacks a name":

https://git.gnome.org/browse/gobject-introspection/tree/girepository/gibaseinfo.c#n284
Comment 2 Adam Stark 2014-06-23 21:39:55 UTC
Created attachment 279074 [details] [review]
patch to gibaseinfo.c

Returns NULL when encountering a TYPE. This isn't quite the correct thing to do, but is a good stop gap measure.
Comment 3 André Klapper 2015-02-07 17:18:00 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
Comment 4 David Lechner 2015-03-25 17:01:51 UTC
I was just going to submit this same patch.

What would be the "correct" thing to do?
Comment 5 GNOME Infrastructure Team 2018-02-08 12:24:38 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gobject-introspection/issues/96.