GNOME Bugzilla – Bug 535849
Confusing valac error message at ownership transfer
Last modified: 2008-06-04 15:00:01 UTC
At compiling valac produces the following error: valaNonGobjectClass.vala:13.3-13.9: error: duplicating Node instance, use weak variable or explicitly invoke copy method Node<G> node = new Node<G>(); ^^^^^^^ ** (valac:23238): CRITICAL **: vala_ccode_assignment_new: assertion `VALA_IS_CCODE_EXPRESSION (r)' failed ** (valac:23238): CRITICAL **: vala_ccode_comma_expression_append_expression: assertion `VALA_IS_CCODE_EXPRESSION (expr)' failed The code: using GLib; public class SomeClass<G> : Object { [Compact] private class Node<G> { public Node<G> next = null; } Node<G> first = new Node<G>(); public void create() { Node<G> node = new Node<G>(); node.next = #first; first = node; } } public static void main(string[] args) { var i = new SomeClass<int>(); i.create(); } The problem is at line: "first = node;" in create method as it node doesn't transfer ownership to first, but as vala reports the error being with ownership transfer at "Node<G> node = new Node<G>();"
Confirming.
2008-06-04 Juerg Billeter <j@bitron.ch> * gobject/valaccodeassignmentbinding.vala: * gobject/valaccodegenerator.vala: Fix error reporting when duplicating non-reference counted objects, fixes bug 535849 Fixed in r1563.