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 667375 - GAsyncInitable subclassing (and async subclassing in general...)
GAsyncInitable subclassing (and async subclassing in general...)
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-01-05 18:21 UTC by Dan Winship
Modified: 2012-01-16 14:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GAsyncInitable: fix subclassibility (1.55 KB, patch)
2012-01-05 18:21 UTC, Dan Winship
committed Details | Review

Description Dan Winship 2012-01-05 18:21:13 UTC
(Conceptual sanity-checking requested...)

If a class implements GAsyncInitable, and its parent also implements it, then the subclass needs to call its parent's init_async() before running its own. But the parent may be depending on the default error-handling in the g_async_initable_init_finish() wrapper, so if you call its ->init_finish() implementation directly, you may get the wrong result. This patch fixes that, at least for the case where the parent class is using the default init_finish implementation. (If it has its own implementation, then that implementation might assume that it will only be called when there is no error, and then return the wrong thing. But this patch doesn't change anything in that case.)

Generically, I think probably the existing gio style, where _finish methods do default error handling, needs to be considered wrong. We haven't run into this before, because no classes in gio currently chain up to parent async methods.
Comment 1 Dan Winship 2012-01-05 18:21:22 UTC
Created attachment 204700 [details] [review]
GAsyncInitable: fix subclassibility

If a class implements GAsyncInitable, and its parent also implements
it, then the subclass needs to call its parent's init_async() before
running its own. This was made more complicated by the fact that the
default init_finish() behavior was handled by the wrapper method
(which can't be used when making the super call) rather than the
default implementation itself. Fix that.
Comment 2 Dan Winship 2012-01-16 14:43:12 UTC
Alex said this made sense to him, so pushed.

Attachment 204700 [details] pushed as afe7a2d - GAsyncInitable: fix subclassibility