gpointer vs gpointer* in GtkBuilderIface
- From: muppet <scott asofyet org>
- To: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: gpointer vs gpointer* in GtkBuilderIface
- Date: Mon, 31 Dec 2007 03:59:21 -0500
While working up bindings for GtkBuildable, i noticed something
interesting:
gboolean (* custom_tag_start) (...,
gpointer *data);
void (* custom_tag_end) (...,
gpointer *data);
void (* custom_finished) (...,
gpointer data);
Since gpointer is typedef'd to void*, this means gpointer* is a void**.
custom_tag_start() is, indeed, supposed to take the data pointer by
reference and write through it like a return parameter.
custom_tag_finished() gets the pointer so it can destroy it if
necessary, as that's the last chance. When i saw the gpointer* on
custom_tag_end(), i assumed this meant that the caller gets a chance
to write through to change it. This is *not* the case.
The code i found implementing custom_tag_end() functions in gtk+ casts
the double-pointer to a single pointer, and the code in
subparser_end() passes subparser->data, not &subparser->data. More
confusingly, parse_custom() puts a gpointer* on the stack, but then
does this:
if (!gtk_buildable_custom_tag_start (...,
(gpointer*)&subparser_data))
return FALSE;
I started to create a patch to fix this, but it looks like it will
reach rather far, as GtkBuildableIface is public, so i figured it
would be good to ask, first ... what's this supposed to be?
--
One, two, free, four, five, six, sebben, eight, nine, ten, elebben,
twull, fourteen, sickteen, sebbenteen, eightteen, elebbenteen,
fiffeen, elebbenteen!
-- Zella, aged three, counting to twenty.
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]