Hello.
Is it possible for a weak ref to know when its peer object has been
deleted (and then assigned to null)?
Because, suppose you have a weak reference, then the real object is deleted.
So your "weak reference" should be notified, otherwise you might get segfaults.
Something to better write the following code:
class Test: Object {
public int i {get; set;}
construct {
i=1;
print("Constructing instance\n");
}
~Test() {
i=0;
print("Finalizing instance\n");
}
}
void main() {
Test t = new Test();
Test **tr = &t;
print("t = %p %d\n", t, t.i);
if(*tr != null)
print("tr = %p %d\n", tr, (*tr)->i);
else
print("Peer object has been deleted\n");
t=null;
if(*tr != null)
print("tr = %p %d\n", tr, (*tr)->i);
else
print("Peer object has been deleted\n");
}
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list