GNOME Bugzilla – Bug 653484
GAsyncCallbacks should default to allow-none
Last modified: 2015-02-07 16:59:04 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.
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.
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 :)
(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.
Created attachment 190927 [details] [review] gasyncresult: document that NULL GAsyncReadyCallback is allowed
Created attachment 190928 [details] [review] giscanner: mark GAsyncReadyCallbacks as allow-none
Review of attachment 190927 [details] [review]: Looks good to me
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 =) )
Review of attachment 190928 [details] [review]: Looks good, thanks.
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
Attachment 190928 [details] pushed as 834f928 - giscanner: mark GAsyncReadyCallbacks as allow-none
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]