On Wed, 2007-05-16 at 23:22 +0100, Chris Vine wrote:
> 
> And you would need to put the "Hello" argument on the heap, and free it
> in the wrapper function, because otherwise it will go out of scope
> before the idle handler is called. (Sigh).  Use g_strdup() to create the
> string on the heap.  Simple examples are never that simple.

On this case, "Hello" is a statically allocated string.  It's always
available and never is destroyed (it is always on the heap, as it were).
Not something that's typically useful, though.  In general, yes, data
must be allocated on the heap, not the stack, in order to be passed to a
callback handler like this.  Unless it's a global static object (such as
a string literal).

> 
> Chris
> 
> 
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to