On Tue, 2010-06-01 at 14:37 +0100, Patrick Welche wrote: > Currently, gtk_widget_get_allocation is defined as: > > void > gtk_widget_get_allocation (GtkWidget *widget, > GtkAllocation *allocation) > { > g_return_if_fail (GTK_IS_WIDGET (widget)); > g_return_if_fail (allocation != NULL); > > *allocation = widget->allocation; > } > > > To use it, I need to > > GtkWidget *w = some_widget_new(some,properties); > GtkAlloction a; > gtk_widget_get_allocation(w, &a); > make use of a->width and friends > then free a? no, wrong. you're passing a pointer to a structure placed on the stack, so you access its member using the point syntax, not the arrow one. and you don't have to allocate/free memory. you can use the heap as well: GtkAllocation *alloc = g_new0 (GtkAllocation, 1); gtk_widget_get_allocation (widget, alloc); /* use the arrow syntax here */ g_free (alloc); > Wouldn't > > GtkAllocation * gtk_widget_get_allocation(GtkWidget *widget) > { > return widget->allocation; > } > > be easier to use / less of a memory management headache as the > memory already is allocated and controlled by the widget? this part doesn't make sense. ciao, Emmanuele. -- W: http://www.emmanuelebassi.name B: http://blogs.gnome.org/ebassi _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list