From: Luca Bruno Date: Sat, 24 Jul 2010 19:20:33 +0000 (+0200) Subject: Add mutex field in priv structures for properties X-Git-Tag: 0.9.8~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9df2ce99f23abfee1ff2341b9e8d92d61cddfbf6;p=thirdparty%2Fvala.git Add mutex field in priv structures for properties Fixes bug 625200. --- diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala index 054fdef76..b2310e705 100644 --- a/codegen/valagtypemodule.vala +++ b/codegen/valagtypemodule.vala @@ -458,6 +458,22 @@ public class Vala.GTypeModule : GErrorModule { } } + foreach (Property prop in cl.get_properties ()) { + if (prop.binding == MemberBinding.INSTANCE) { + if (prop.get_lock_used ()) { + has_instance_locks = true; + // add field for mutex + instance_priv_struct.add_field (mutex_type.get_cname (), get_symbol_lock_name (prop.name)); + } + } else if (prop.binding == MemberBinding.CLASS) { + if (prop.get_lock_used ()) { + has_class_locks = true; + // add field for mutex + type_priv_struct.add_field (mutex_type.get_cname (), get_symbol_lock_name (prop.name)); + } + } + } + if (is_gtypeinstance) { if (cl.has_class_private_fields || has_class_locks) { decl_space.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf (type_priv_struct.name), new CCodeVariableDeclarator ("%sClassPrivate".printf (cl.get_cname ()))));