]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Add mutex field in priv structures for properties
authorLuca Bruno <lethalman88@gmail.com>
Sat, 24 Jul 2010 19:20:33 +0000 (21:20 +0200)
committerJürg Billeter <j@bitron.ch>
Fri, 20 Aug 2010 08:17:56 +0000 (10:17 +0200)
Fixes bug 625200.

codegen/valagtypemodule.vala

index 054fdef7650c565946add3acfa88f6d7644da67c..b2310e70553da6238f744229dee7103ace287e83 100644 (file)
@@ -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 ()))));