After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 54946 - need a g_object_newv function
need a g_object_newv function
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gobject
1.3.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2001-05-19 14:37 UTC by James Henstridge
Modified: 2011-02-18 15:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
first go at g_object_newv patch (6.42 KB, patch)
2001-06-13 08:52 UTC, James Henstridge
none Details | Review
revised g_object_newv patch (7.65 KB, patch)
2001-06-13 11:48 UTC, James Henstridge
none Details | Review

Description James Henstridge 2001-05-19 14:37:10 UTC
It would be very useful to have a "g_object_newv" function in libgobject. 
The existing g_object_new and g_object_new_valist are inapropriate in cases
where you can't use a C varargs function (eg. language bindings, or maybe a
GUI builder).

The contents of the g_object_new_valist is non trivial and accesses a few
structure members that are marked private, so it doesn't seem safe for a
user of the library to reimplement this function without the use of valists.
Comment 1 James Henstridge 2001-06-13 08:52:20 UTC
Created attachment 645 [details] [review]
first go at g_object_newv patch
Comment 2 James Henstridge 2001-06-13 08:54:50 UTC
I just attached the first go at the g_object_newv patch.  Haven't done
much testing on it yet.  I will attach another patch once it is tested
a bit more and I have converted g_object_new_valist over to using
g_object_newv (and documented it).  Does the API look okay?
Comment 3 James Henstridge 2001-06-13 11:26:23 UTC
There should be a ! in the G_VALUE_HOLDS check I added in
g_object_newv.  The way it is now, it will fail on correctly typed
values.  Will fix in next version of patch.
Comment 4 James Henstridge 2001-06-13 11:48:06 UTC
Created attachment 649 [details] [review]
revised g_object_newv patch
Comment 5 James Henstridge 2001-06-13 11:52:22 UTC
Attached revised version of patch, which fixes the logic error and
converts g_object_new_valist to a wrapper around g_object_newv.

The gtk-demo program seems to work fine with this patch applied, and
so does the tests/simple test program (which makes use of this codepath).

I believe this should be okay to apply (unless there are some issues
with the API or bugs I haven't seen).
Comment 6 James Henstridge 2001-06-20 08:44:05 UTC
Tim applied patch to CVS, so marking bug as resolved.