go-gtk
go-gtk copied to clipboard
Getters constructing new widgets
I have been looking at some of the get* functions, like this one
func (v *Dialog) GetWidgetForResponse(id int) *Widget {
panic_if_version_older(2, 20, 0, "gtk_dialog_get_widget_for_response()")
return &Widget{C._gtk_dialog_get_widget_for_response(DIALOG(v), gint(id))}
}
and it seems to me that this function constructs a new Widget every time it is called.
Even if the GC will get rid of these duplicates at some point it still seems wrong to me. Wouldn't it be more correct to have it return the same Widget?
Impossible. If doing this, We must have pool of Widget struct array.