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 653484 - GAsyncCallbacks should default to allow-none
GAsyncCallbacks should default to allow-none
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2011-06-27 13:04 UTC by Guillaume Desmottes
Modified: 2015-02-07 16:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gasyncresult: document that NULL GAsyncReadyCallback is allowed (1.34 KB, patch)
2011-06-29 12:42 UTC, Dan Winship
committed Details | Review
giscanner: mark GAsyncReadyCallbacks as allow-none (2.17 KB, patch)
2011-06-29 12:42 UTC, Dan Winship
committed Details | Review

Description Guillaume Desmottes 2011-06-27 13:04:31 UTC
I just updated my gjs and noticed that null is not allowed any more as a GAsyncCallbacks parameter if the _async function doesn't have the allow-non  annotation.

That's an annoying semantic change that will probably break lot of code.
Those should default to allow-none as you're always allowed to not call the _finish function.
Comment 1 Giovanni Campagna 2011-06-27 14:31:00 UTC
Is it really that can always pass null? That is, do all functions that take GAsyncReadyCallback check for NULL?
An error here means a segfault, so we should be very careful. Plus, there is no (no-allow-none), so libraries that don't accept NULL would need code changes.

Anyway, this change should be done at GIR generation level (like for GCancellable), so reassigning.
Comment 2 Dan Winship 2011-06-27 14:38:55 UTC
GSimpleAsyncResult checks for NULL callback. I don't think there are any methods that take a GAsyncReadyCallback that don't use GSimpleAsyncResult.

However, the GAsyncResult docs (which explain gio async APIs in general) don't explicitly say that you can pass a null callback. Though we could fix that :)
Comment 3 David Zeuthen (not reading bugmail) 2011-06-27 14:53:47 UTC
(In reply to comment #2)
> However, the GAsyncResult docs (which explain gio async APIs in general) don't
> explicitly say that you can pass a null callback. Though we could fix that :)

I think we should - being able to pass NULL is very convenient and fits nicely in with the "you don't have to call the _finish() function" requirement.
Comment 4 Dan Winship 2011-06-29 12:42:24 UTC
Created attachment 190927 [details] [review]
gasyncresult: document that NULL GAsyncReadyCallback is allowed
Comment 5 Dan Winship 2011-06-29 12:42:33 UTC
Created attachment 190928 [details] [review]
giscanner: mark GAsyncReadyCallbacks as allow-none
Comment 6 Matthias Clasen 2011-06-30 17:58:01 UTC
Review of attachment 190927 [details] [review]:

Looks good to me
Comment 7 Colin Walters 2011-06-30 18:37:03 UTC
Review of attachment 190927 [details] [review]:

The parenthetical use is weird and unnecessary.  Just "You can pass..." would be better.  (And s/can/may/ if while you're there =) )
Comment 8 Colin Walters 2011-06-30 18:55:31 UTC
Review of attachment 190928 [details] [review]:

Looks good, thanks.
Comment 9 Dan Winship 2011-07-01 15:28:48 UTC
Comment on attachment 190927 [details] [review]
gasyncresult: document that NULL GAsyncReadyCallback is allowed

Attachment 190927 [details] pushed as 2080bb1 - gasyncresult: document that NULL GAsyncReadyCallback is allowed
Comment 10 Dan Winship 2011-07-01 15:29:23 UTC
Attachment 190928 [details] pushed as 834f928 - giscanner: mark GAsyncReadyCallbacks as allow-none
Comment 11 André Klapper 2015-02-07 16:59:04 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]