Re: [Vala] Life time of args passsed to async methods



This is generally safe, since objects are reference counted. Even if the
async method keeps executing in the background, the async method will
decrease it's reference when it no longer needs the object (this is done
automatically for you), in which case the object will be freed (that if
there is no other reference for this object somewhere else).

*Alexandre Rosenfeld*

On Fri, Apr 15, 2011 at 20:00, Nor Jaidi Tuah <norjaidi tuah ubd edu bn>wrote:

Is the following safe? Will the argument be
freed when xx returns, but async_method is still
in the background?

  void xx () {
     async_method (new SomeObject ());
  }

What about the "this" argument in the following;
is it safe?

  void xx () {
     var y = new SomeOject ();
     y.async_method ();
  }

I tried to figure out the answer to these question
from the generated C, but was lost in the tangle.

hand
Nor Jaidi Tuah


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



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