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 131076 - Bad GBoxed type usage in gsourceclosure
Bad GBoxed type usage in gsourceclosure
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gobject
2.2.x
Other All
: High major
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2004-01-10 10:18 UTC by Manish Singh
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Manish Singh 2004-01-10 10:18:05 UTC
In g_io_channel_get_type():

    our_type = g_boxed_type_register_static ("GIOChannel",
                                             (GBoxedCopyFunc) g_io_channel_ref,
                                             (GBoxedFreeFunc)
g_io_channel_unref);

The GBoxed code relies on the GBoxedCopyFunc associated with a type to
return a gpointer. However, g_io_channel_ref returns void, so the value is
undefined.

Possible solutions are:

1) API change, make g_io_channel_ref return its GIOChannel * instead of void.
2) Implement a private copy function in gsourceclosure.c to wrap
g_io_channel_ref and return the GIOChannel * itself.

I prefer solution #1, but since it's an API change I'm filing it here for
others to comment instead of just committing a fix.
Comment 1 Tim Janik 2004-01-10 18:57:25 UTC
g_io_channel_ref() should return the referenced object as all _ref()
functions should. basta, issue fixed ;)
Comment 2 Manish Singh 2004-01-10 20:55:56 UTC
fwiw,  g_main_context_ref, g_hook_ref, g_async_queue_ref, and
g_async_queue_ref_unlocked all return void currently as well.
Comment 3 Manish Singh 2004-01-12 00:00:29 UTC
Sun Jan 11 15:34:35 2004  Manish Singh  <yosh@gimp.org>
 
        * gsourceclosure.c: wrap g_io_channel_ref in a function that
returns
        the passed in GIOChannel, so we aren't abusing GBoxedCopyFunc
        semantics. Fixes bug #131076.

Should open a bug for 2.6 regarding the inconsistent ref APIs.