[Vala] After transfering ownership of compact class, Vala still call free method




I'm trying to write a nodes system which is tree based. Not matter how it
works, this is part of the code:

NodesRoot root = new NodesRoot ();
stdout.printf ("Root created\n");
unowned NodesUnit unit = root.prepend_unit ();
if (unit == null)
stderr.printf ("Not working!");
stdout.printf ("Unit created\n");
Node node = new Node ();
stdout.printf ("Node created\n");
unit.prepend_node ((owned)node);
stdout.printf ("Node prepended\n");

node = null;// Ensure that node will be free before root if it will.
stdout.printf ("Node is null\n");

this is the runtime:
Root created
Unit created
Node created
Node prepended
Node is null
*** glibc detected *** ./simple_triangle: free(): invalid pointer: 0x000000000190cc40 ***
======= Backtrace: =========
(big memory trace)

I've noticed that in the generated C code, node get freed by Vala.
Why is it happening if I transferred ownership for the method?
Doesn't the ownership transferring make the original unowned?

Tal
                                          


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]