From: Rico Tzschichholz Date: Sun, 4 Nov 2018 21:49:04 +0000 (+0100) Subject: codegen: Don't emit *_free() of derived compact classes X-Git-Tag: 0.42.3~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2cb8387e83b9ab07ba5cacdbe5f54be07c61264f;p=thirdparty%2Fvala.git codegen: Don't emit *_free() of derived compact classes Found with -Werror=missing-prototypes --- diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala index 6b60f7ef3..dcc51a107 100644 --- a/codegen/valagtypemodule.vala +++ b/codegen/valagtypemodule.vala @@ -1788,7 +1788,7 @@ public class Vala.GTypeModule : GErrorModule { call.add_argument (new CCodeIdentifier ("self")); ccode.add_expression (call); } - } else { + } else if (cl.base_class == null) { var function = new CCodeFunction ("%sfree".printf (get_ccode_lower_case_prefix (cl)), "void"); if (cl.is_private_symbol ()) { function.modifiers = CCodeModifiers.STATIC; @@ -1836,6 +1836,7 @@ public class Vala.GTypeModule : GErrorModule { } cfile.add_function_declaration (instance_finalize_context.ccode); + cfile.add_function (instance_finalize_context.ccode); } else if (cl.base_class == null) { var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_slice_free")); ccall.add_argument (new CCodeIdentifier (get_ccode_name (cl))); @@ -1843,9 +1844,11 @@ public class Vala.GTypeModule : GErrorModule { push_context (instance_finalize_context); ccode.add_expression (ccall); pop_context (); - } - cfile.add_function (instance_finalize_context.ccode); + cfile.add_function (instance_finalize_context.ccode); + } else if (cl.base_class == gsource_type) { + cfile.add_function (instance_finalize_context.ccode); + } } public override CCodeExpression get_param_spec_cexpression (Property prop) {