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 595587 - Properties whose types are nullable structs are being handled incorrectly
Properties whose types are nullable structs are being handled incorrectly
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Objects
0.7.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2009-09-18 14:09 UTC by Levi Bard
Modified: 2009-09-26 14:10 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Levi Bard 2009-09-18 14:09:26 UTC
using GLib;

public class Blah: Object {
        public Foo? foo {
                get{ return myFoo; }
                set {
                        if(null == value) {
                                myFoo = Foo();
                        } else {
                                myFoo = value;
                        }
                }
        }
        private Foo myFoo;

        public static int main(){ return 0; }
}


public struct Foo {
        public int x;
        public Foo(){ x = 0; }
}// Foo

/** Generated C Code for foo setter

void blah_set_foo (Blah* self, Foo* value) {
        g_return_if_fail (self != NULL);
        if (NULL == (*value)) {
                Foo _tmp0_ = {0};
                self->priv->myFoo = (foo_init (&_tmp0_), _tmp0_);
        } else {
                self->priv->myFoo = *(*value);
        }
        g_object_notify ((GObject *) self, "foo");
}

**/

/** Valac output

> valac -o blah blah.vala
/home/lbar4/dev/blah.vala.c: In function ‘blah_set_foo’:
/home/lbar4/dev/blah.vala.c:97: error: invalid operands to binary == (have ‘void *’ and ‘Foo’)
/home/lbar4/dev/blah.vala.c:101: error: invalid type argument of ‘unary *’ (have ‘Foo’)
/home/lbar4/dev/blah.vala.c: In function ‘blah_get_property’:
/home/lbar4/dev/blah.vala.c:146: error: too many arguments to function ‘blah_get_foo’
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)

**/
Comment 1 Jürg Billeter 2009-09-21 18:45:30 UTC
commit 217a1a82d63ee8e4aedcdf3409de4f12cc38c962
Author: Jürg Billeter <j@bitron.ch>
Date:   Mon Sep 21 20:44:34 2009 +0200

    D-Bus: Support name attribute for members in clients and servers
    
    Fixes bug 595587.
Comment 2 Jürg Billeter 2009-09-21 18:45:59 UTC
Sorry, wrong bug.
Comment 3 Jürg Billeter 2009-09-22 20:59:16 UTC
commit 0920805aa49de47216f1d1f5d4b2ff9c92df5d61
Author: Jürg Billeter <j@bitron.ch>
Date:   Tue Sep 22 22:58:10 2009 +0200

    Fix nullable struct properties
    
    Fixes bug 595587.
Comment 4 Jürg Billeter 2009-09-26 14:10:18 UTC
commit 65ff8c34df5fd892e209e570c292a5f6a5c4d0ed
Author: Jürg Billeter <j@bitron.ch>
Date:   Sat Sep 26 16:09:51 2009 +0200

    Add test for bug 595587