GNOME Bugzilla – Bug 116734
object properties should not be G_TYPE_POINTER
Last modified: 2005-05-19 13:11:30 UTC
i'm writing perl bindings for libgnomecanvas (http://gtk2-perl.sourceforge.net/); these bindings rely on proper argument types (e.g., double, boxed, object, etc) for values to pass correctly through g_object_set, including gnome_canvas_item_new, which uses g_object_set. however, some object properties (GnomeCanvasItem's bpath property, GnomeCanvasClipGroup's bpath property, and GnomeCanvasShape's dash property) are declared as G_TYPE_POINTER properties; this means that no type-checking can be done, no destructors or indeed any type-based code can be used for these properties, which means i can't bind them to perl. in general, G_TYPE_POINTER is dangerous and should not be used, as it makes life difficult in non-C languages. there needs to be GBoxed wrappers for the various datatypes involved. this situation exists in 2.0.5 and in cvs HEAD as of 4july03 (according to cvs.gnome.org).
I see only one G_TYPE_POINTER reference in the sources now and that's render_background.
*** Bug 131280 has been marked as a duplicate of this bug. ***
g_param_spec_pointer() creates properties of G_TYPE_POINTER. see libgnomecanvas/libgnomecanvas/gnome-canvas-bpath.c:103: g_object_class_install_property (gobject_class, PROP_BPATH, g_param_spec_pointer ("bpath", NULL, NULL, (G_PARAM_READABLE | G_PARAM_WRITABLE))); a boxed trivial boxed wrapper for the struct would save a lot of grief.
Created attachment 23746 [details] [review] Add boxed type support for GnomeCanvasPathDef and use it in GnomeCanvasBpath.
This patch should be applied. it is an API change technically, but it doeasn't have any mallicious effects in practice (g_object_set() statements will continue to work).
Applied. Thanks.