GNOME Bugzilla – Bug 667375
GAsyncInitable subclassing (and async subclassing in general...)
Last modified: 2012-01-16 14:43:15 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.
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.
Alex said this made sense to him, so pushed. Attachment 204700 [details] pushed as afe7a2d - GAsyncInitable: fix subclassibility