]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Cast vfunc pointer assigns of abstract overrides
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 25 Feb 2017 12:09:35 +0000 (13:09 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 25 Feb 2017 12:20:52 +0000 (13:20 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=777958

codegen/valagtypemodule.vala

index 7e5639f60d34559f10b31c9c2dc3d42082b04a22..6b0c4daa85d5e7aedb000729c976d69925283235 100644 (file)
@@ -1208,12 +1208,14 @@ public class Vala.GTypeModule : GErrorModule {
                        if (m.base_method == null) {
                                continue;
                        }
-                       var base_type = m.base_method.parent_symbol;
+                       var base_type = (ObjectTypeSymbol) m.base_method.parent_symbol;
 
                        // there is currently no default handler for abstract async methods
                        if (!m.is_abstract || !m.coroutine) {
+                               CCodeExpression cfunc = new CCodeIdentifier (get_ccode_real_name (m));
+                               cfunc = cast_method_pointer (m.base_method, cfunc, base_type);
                                var ccast = new CCodeCastExpression (new CCodeIdentifier ("klass"), "%sClass *".printf (get_ccode_name (base_type)));
-                               ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, get_ccode_vfunc_name (m.base_method)), new CCodeIdentifier (get_ccode_real_name (m)));
+                               ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, get_ccode_vfunc_name (m.base_method)), cfunc);
 
                                if (m.coroutine) {
                                        ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, get_ccode_finish_vfunc_name (m.base_method)), new CCodeIdentifier (get_ccode_finish_real_name (m)));