Im pretty new to both glib/gobject and vala so I might be missing something, 
but creating a weak reference is supposed not to create a new reference to the 
object it points to.

On the other hand var is supposed to guess the type of the reference, so one 
will not have to type it explicitly.
But when using var on functions, returning aweak reference the ref_count is 
increased with is not the case if the same if the same expression is typed 
manually:

VALA:
using GLib;

public class WeakTest {
    static Object o = null; 

    public static weak Object get_object () {
      o = new Object();
      return o;
    }

    static int main (string[] args) {
        
      weak Object localo = get_object();
      message("ref_count: %d",(int)localo.ref_count);
        return 0;
    }
}
RETURN:
** Message: weak_tst.vala:16: ref_count: 2
C-FILE:



      
_______________________________________________
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to