Re: GtkAllocation accessor

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

 



On Wed, Jun 02, 2010 at 03:23:21PM +0200, Tadej Borov??ak wrote:
> Hello.
> 
> > #if GTK_CHECK_VERSION (2,18,0)
> > static GtkAllocation *dasher_get_widget_allocation(GtkWidget *w)
> > {
> >        GtkAllocation a;
> >
> >        gtk_widget_get_allocation(w, &a);
> >
> >        return &a;
> > }
> > #endif
> 
> Just don't do this. Returning a pointer to a stack-allocated structure
> is just screaming "SIGSEGV".

Which is why this isn't committed ;-) But finally you see the point?

> I can agree that updating applications to work with GTK+-3 will be a
> major pain in the *** in some cases (yours being one example), but I
> fail to see why would newly written applications need to suffer from
> inconsistent API just to make old apps a bit happier (they will still
> need to be updated).

This all seems odd to me because the widget contains the allocation already.
I don't give the address of a GtkWidget to some_widget_new() for it to
fill in the structure. I call some_widget_new() and it returns a pointer
to the widget which contains the allocation... All I need is a pointer to
that allocation. I don't understand the motivation for having to copy the
allocation...

Cheers,

Patrick
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list



[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux