Hi Luca, Example attached. Output (compiled with valac 0.24) is:
ReaderState start: k 0x2233030 (process:28945): GLib-GObject-WARNING **: cannot retrieve class for invalid (unclassed) type '(null)' ReaderState end: k 0x2233030 this.kl: (nil) klass: 0x2233030 r.kl: (nil) Set_state start r.kl (nil) Set_state end k: (nil), r.kl (nil) 196, 0x2233030 : 196, (nil) After doing this I installed 0.25.3, which provides hints by way of compilation errors: t7.vala:10.17-10.17: error: duplicating TypeClass instance, use unowned variable or explicitly invoke copy method this.kl = k; ^ ** (valac:29749): CRITICAL **: vala_ccode_assignment_module_real_store_field: assertion 'value != NULL' failed t7.vala:18.9-18.12: error: duplicating TypeClass instance, use unowned variable or explicitly invoke copy method k = r.kl; ^^^^ ** (valac:29749): CRITICAL **: vala_ccode_assignment_module_real_store_parameter: assertion '_value != NULL' failed Compilation failed: 2 error(s), 0 warning(s) So perhaps that resolves the problem. Regards, Andrew Lees. On Fri, Sep 12, 2014 at 5:41 PM, Luca Bruno <lethalma...@gmail.com> wrote: > On 12/09/2014 02:31, Andy Lees wrote: > > Greetings, > > > > I have a data type used to store parser state declared as: > > class ReaderState { > > public Object obj; > > public bool in_array; > > public Type type; > > public TypeClass kl; > > > > public ReaderState (Object o, bool a, Type t, TypeClass k) { > > this.obj = o; > > this.in_array = a; > > this.type = t; > > this.klass = k; > > } > > } > > Can you please provide a self-contained test case with a main() that I > can compile and run? > _______________________________________________ > vala-list mailing list > vala-list@gnome.org > https://mail.gnome.org/mailman/listinfo/vala-list >
class ReaderState { public Type type; public TypeClass kl; public ReaderState (Type t, TypeClass k) { stdout.printf("ReaderState start: k %p\n", k); this.type = t; this.kl = k; stdout.printf("ReaderState end: k %p this.kl: %p\n", k, this.kl); } } static void set_state(ReaderState r, out Type t, out TypeClass k) { stdout.printf("Set_state start r.kl %p\n", r.kl); t = r.type; k = r.kl; stdout.printf("Set_state end k: %p, r.kl %p\n", k, r.kl); } public static int main(string [] argv) { var type = typeof (ReaderState); var klass = type.class_ref (); Type t2; TypeClass kl2; ReaderState r = new ReaderState (type, klass); stdout.printf("klass: %p r.kl: %p\n", klass, r.kl); set_state (r, out t2, out kl2); stdout.printf("%d, %p : %d, %p\n", (int)type, klass, (int)t2, kl2); return 0; }
_______________________________________________ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list