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

2011-04-15 Thread Alexandre Rosenfeld
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

[Vala] Life time of args passsed to async methods

2011-04-15 Thread Nor Jaidi Tuah
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_

[Vala] extern function prototype gets rearranged

2011-04-15 Thread Sam Thursfield
Hi! I've encountered a weird bug/feature which is breaking everything. Here's a simple testcase: namespace Test { public extern struct Value { void *ptr; public extern unowned GLib.Date get_date (); } int main(string args[]) { Test.Value v = Test.Value(); Date n

Re: [Vala] Invalid assignment from owned expression to unowned variable

2011-04-15 Thread Joseph Montanez
Here is the adjusted file with all of code of why I am using "out" valac -g --pkg libsoup-2.4 --pkg gee-1.0 --pkg gnet-2.0 --pkg json-glib-1.0 --save-temps --thread mywebapp.vala https://gist.github.com/922304 mywebapp.vala:11.29-11.39: error: No reference to be transferred Soup.Message m

Re: [Vala] Invalid assignment from owned expression to unowned variable

2011-04-15 Thread Joseph Montanez
Abderrahim, 1) msg = (owned) msg; Results in "No reference to be transferred" As to why I am using "out" is because when I was changing the "msg.response_headers" and the changes where not being reflected back when I was finished using msg. 2) public string get_session_id (unowned Soup

Re: [Vala] Invalid assignment from owned expression to unowned variable

2011-04-15 Thread Abderrahim Kitouni
Hello, On Thu, Apr 14, 2011 at 6:45 PM, Joseph Montanez > wrote: > > I got it, I needed > > > > public void dostuff (out unowned Soup.Message msg) > > > > and then I could do: > > dostuff(out msg); > > No you shouldn't. You probably need to transfer ownership as in: public void dostuff (out uno

Re: [Vala] Invalid assignment from owned expression to unowned variable

2011-04-15 Thread Joseph Montanez
Actually when I access anything from "msg", it just segment faults :( https://gist.github.com/922060 On Thu, Apr 14, 2011 at 6:45 PM, Joseph Montanez wrote: > I got it, I needed > > public void dostuff (out unowned Soup.Message msg) > > and then I could do: > dostuff(out msg); > > On Thu, Apr 14