On Tue, Oct 17, 2006 at 11:02:32AM -0700, Brian J. Tarricone wrote:
> On 10/17/2006 5:17 AM, David Ne?as (Yeti) wrote:
> > On Tue, Oct 17, 2006 at 01:51:47PM +0200, Lorenzo Marcon wrote:
> >> int main(int argc, char *argv[]) {
> >> ...
> > 
> > This is quite cumbersome...
> 
> Not to mention the fact that 'data' is allocated on the stack and ceases
> to exist after this function exits, so the pointer you pass to
> g_signal_connect() will be garbage later.  Not only should you use a
> struct for convenience as David suggests, but you need to allocate the
> struct on the heap (via g_malloc() or g_new(), etc.).

I was about to write this too, then I realized the function
is main().  So in this particular case the code is probably
correct though weird.  Anyway, it never hurts to warn of
this problem...

Yeti


--
Whatever.
_______________________________________________
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