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 704902 - Fix gjs_value_to_g_value_internal() for uninitialized enum types
Fix gjs_value_to_g_value_internal() for uninitialized enum types
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2013-07-26 00:49 UTC by Florian Müllner
Modified: 2013-09-04 18:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix gjs_value_to_g_value_internal() for uninitialized enum types (1.48 KB, patch)
2013-07-26 00:49 UTC, Florian Müllner
reviewed Details | Review
Fix gjs_value_to_g_value_internal() for uninitialized enum types (1.35 KB, patch)
2013-07-26 01:14 UTC, Florian Müllner
needs-work Details | Review
Fix gjs_value_to_g_value_internal() for uninitialized enum types (1.34 KB, patch)
2013-07-26 07:46 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2013-07-26 00:49:31 UTC
See patch.
Comment 1 Florian Müllner 2013-07-26 00:49:34 UTC
Created attachment 250164 [details] [review]
Fix gjs_value_to_g_value_internal() for uninitialized enum types

g_type_class_peek() will fail if the type's class has never been
referenced before (and we'll fail with an unhelpful error message).

Call g_type_class_ref() only in that case to ensure the class structure
has been initialized.
Comment 2 Colin Walters 2013-07-26 01:07:36 UTC
Review of attachment 250164 [details] [review]:

I think we should just call g_type_class_ref() always.  Also, hi!
Comment 3 Colin Walters 2013-07-26 01:07:58 UTC
(And do the corresponding _unref() always)
Comment 4 Florian Müllner 2013-07-26 01:14:34 UTC
Created attachment 250165 [details] [review]
Fix gjs_value_to_g_value_internal() for uninitialized enum types

OK, sure ... (and hi back!)
Comment 5 Jasper St. Pierre (not reading bugmail) 2013-07-26 01:50:51 UTC
Review of attachment 250165 [details] [review]:

::: gi/value.c
@@ +474,2 @@
             /* See arg.c:_gjs_enum_to_int() */
+            v = g_enum_get_value(G_ENUM_CLASS(g_type_class_ref(gtype)),

I assume thins should be G_ENUM_CLASS(gtype_class), not another ref...
Comment 6 Florian Müllner 2013-07-26 07:46:34 UTC
Created attachment 250181 [details] [review]
Fix gjs_value_to_g_value_internal() for uninitialized enum types

Yeah ... (shouldn't hastily update patches past 3am :-( )
Comment 7 Colin Walters 2013-07-26 11:49:37 UTC
Review of attachment 250181 [details] [review]:

Looks good.
Comment 8 Colin Walters 2013-08-06 09:50:29 UTC
This was pushed.
Comment 9 Ray Strode [halfline] 2013-09-04 18:32:46 UTC
(closing given comment 8)