[Vala] Behaviour of assigning object obtained via property (unowned) to strong reference



Hi

I'm having trouble debugging my application, I'm getting references suddenly
becoming null, and I'm finding the existing explanations surrounding memory
management in vala confusing.

The explanation at http://live.gnome.org/Vala/ReferenceHandling has got:
Vala prevents you from assigning an unowned reference to a strong (i.e.
not unowned) reference. However, you can transfer the ownership to another
reference with (owned)

But then the tutorial at http://live.gnome.org/Vala/Tutorial has got:
If the calling code is written as
Object o = get_unowned_ref();
Vala will try to either obtain a reference of or a duplicate of the
instance the unowned reference pointing to

Since I'm not getting compiling errors or warnings I assume that the latter
is what's happening, but I still don't know exactly what's happening. Is it
making a copy, increasing the ref count by 1 or transferring ownership?


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