GNOME Bugzilla – Bug 587493
ushort nonfunctional in GLib.Object derived classes
Last modified: 2009-07-08 13:12:47 UTC
Steps to reproduce: 1. Create the following program and save to disk as 'us.vala': using GLib; public class UShortTest : Object { private ushort _us; public ushort us { get { return(_us); } } public UShortTest() { _us = 0; } public static int main(string[] args) { UShortTest ust = new UShortTest(); stdout.printf("ust value: %d\n", ust.us); return(0); } } 2. With Vala 0.7.4 run "valac us.vala". A crash occurs. 3. Remove the “: Object” from the class declaration. 4. Run “valac us.vala”. No crash, executable is compiled and it runs. Stack trace: Wednesday, 2009-Jul-01 at 03:31:12 - mbt@zest - Linux v2.6.30 Ubuntu Jaunty:[2-55/10577-0]:vala> valac us.vala glib-2.0.vapi:181.1-181.20: error: The value type `ushort` doesn't declare a GValue set function public struct ushort { ^^^^^^^^^^^^^^^^^^^^ ** (valac:4568): CRITICAL **: vala_ccode_identifier_construct: assertion `_name != NULL' failed Compilation failed: 1 error(s), 0 warning(s) Other information: This error only occurs when the class derives from GLib.Object; if the class does not derive from GLib.Object, it works just fine. I have not found a workaround for this issue while maintaining the necessary data type.
I have updated to Vala's git master on my system, and am still experiencing this error... just wanted to make it known that the problem is still in the mainline (I hadn't expected otherwise, but it never hurts to check...)
It seems this depends on existing bug 562498 per chat in IRC and http://library.gnome.org/devel/gobject/stable/gobject-Standard-Parameter-and-Value-Types.html
Created attachment 137715 [details] [review] Add 16-bit signed and unsigned integer support to Vala This change depends on bug 562498 being fixed in glib.
Created attachment 137716 [details] [review] Add 16-bit signed and unsigned integer support to Vala My apologies, I totally don't know how to use git. This one should *actually* contain the patch.
Thanks for the patch. I'd like to defer applying this to Vala until bug 562498 has been resolved. This bug can be fixed before that, though.
commit 121870d130385a85185bbf99b2d0a077a6ab0413 Author: Jürg Billeter <j@bitron.ch> Date: Wed Jul 8 14:06:53 2009 +0100 Fix short and ushort properties in GObject classes Fixes bug 587493.