[Vala] Passing Ownership Help
- From: Peter Cartwright <peter public use gmail com>
- To: vala-list gnome org
- Subject: [Vala] Passing Ownership Help
- Date: Sun, 10 Jul 2011 02:36:23 +0900
Hi guys,
I am trying to understand how a function can take ownership of an object
passed into it. According to documentation it should be like below:
MyList.add (owned Person p) {
_first = (owned) p;
}
Person p = new Person ("Bobby");
List.add (p);
stdout.printf ("%u\n", p.ref_count);
But when I do it like this and check the reference count of p, it is equal
to 2... shouldn't it be 1? I want the list to be the new owner of P.
cheers,
Peter
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]