Re: Re: send_action_list vala



On Sa, 2012-02-11 at 15:22 +0100, andrea zambon wrote:
> >> Ok, attached a modified version of the patch to
> >> https://bugzilla.gnome.org/show_bug.cgi?id=669702
> 
> I downloaded the git version and applied the patch but I get an error.
> I applied the patch manually with an editor.
> 
> >> Ok, attached a modified version of the patch to
> >> https://bugzilla.gnome.org/show_bug.cgi?id=669702. GUPnP allocates
> >> GValue with g_slice_new but Vala generates g_free for it. The new
> >> version of the patch removes automatic memory management from the output
> >> values, so you either have to free them individually with
> >> GLib.Slice.free (typeof (Value), v) or use the convenience function I
> >> added to do that for the whole list. Also note since Value* is now a
> >> pointer, you have to use -> instead of ".".
> 
> Mmm ... I don't understand. What is now a pointer? List or values​​?
> Can you give me a little hint?
Value. Sorry. And only on the out_values list.

var out_values = new List<Value*> ();
proxy.send_action_list("GetProtocolInfo",in_names,in_values,out_names,out_types,out out_values);
foreach (var v in out_values) {
	stdout.printf ("%s\n", (string) *v);
	// Then either do here:
  	// v->unset();
	// Slice.free (typeof (Value, v));
}

// or afterwards do: 
// value_list_free (out_values); 

> 
> var out_values = new List<Value?> ();
> proxy.send_action_list("GetProtocolInfo",in_names,in_values,out_names,out_types,out
> out_values);
> foreach (Value? v in out_values) {
> 	stdout.printf ("%s\n", v->get_string() );
> }
> 
> Thanks
> 




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