GNOME Bugzilla – Bug 688375
Crash when trying to override GInterface method
Last modified: 2015-02-07 16:50:12 UTC
Created attachment 229029 [details] test script See the attached example crashing when trying to override ClutterContainerIface->actor_removed.
+ Trace 231178
While we should not crash in this case, the problem is that you're not implementing Clutter.Container.
How so? ClutterContainer is implemented by ClutterActor from which my object inherit.
Yes, but in GObject, if you want to override an interface method, you need to implement the interface again. Think of how you would do it in C: you would call G_IMPLEMENT_INTERFACE, and then override the interface method inside the iface_init(). You can't do the override from class_init(), or anywhere else.
(In reply to comment #1) > While we should not crash in this case, the problem is that you're not > implementing Clutter.Container. Nope, it crashes in exactly the same way if I add: Implements: [ Clutter.Container ], to Guillaume's example.
Created attachment 257093 [details] Guillaume's test case, with the missing “Implements: [ Clutter.Container ]” added
Created attachment 257134 [details] [review] GIVFuncInfo: allow retrieving the address of an interface vfunc Don't assume that the parent of a GIVFuncInfo is a GIObjectInfo, it could be a GIInterfaceInfo, if the vfunc is part of interface instead of a class.
Review of attachment 257134 [details] [review]: ::: girepository/givfuncinfo.c @@ -255,3 @@ func = *(gpointer*) G_STRUCT_MEMBER_P (implementor_vtable, offset); - g_type_class_unref (implementor_vtable); - g_base_info_unref (field_info); Memory leak? Why was this removed?
Created attachment 257789 [details] [review] GIVFuncInfo: allow retrieving the address of an interface vfunc Don't assume that the parent of a GIVFuncInfo is a GIObjectInfo, it could be a GIInterfaceInfo, if the vfunc is part of interface instead of a class.
Review of attachment 257789 [details] [review]: Ok, makes sense.
Attachment 257789 [details] pushed as f7acdd3 - GIVFuncInfo: allow retrieving the address of an interface vfunc
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]