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 587493 - ushort nonfunctional in GLib.Object derived classes
ushort nonfunctional in GLib.Object derived classes
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Basic Types
0.7.x
Other All
: Normal critical
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on: 562498
Blocks:
 
 
Reported: 2009-07-01 07:33 UTC by Michael Trausch
Modified: 2009-07-08 13:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add 16-bit signed and unsigned integer support to Vala (626 bytes, patch)
2009-07-02 00:08 UTC, Michael Trausch
none Details | Review
Add 16-bit signed and unsigned integer support to Vala (3.06 KB, patch)
2009-07-02 00:13 UTC, Michael Trausch
reviewed Details | Review

Description Michael Trausch 2009-07-01 07:33:28 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.
Comment 1 Michael Trausch 2009-07-01 16:22:21 UTC
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...)
Comment 2 Michael Trausch 2009-07-01 20:15:24 UTC
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
Comment 3 Michael Trausch 2009-07-02 00:08:29 UTC
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.
Comment 4 Michael Trausch 2009-07-02 00:13:40 UTC
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.
Comment 5 Jürg Billeter 2009-07-08 13:11:05 UTC
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.
Comment 6 Jürg Billeter 2009-07-08 13:12:47 UTC
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.