[vala] Fix static owned delegate fields



commit 5c5f0ce28df21f2f0f4c9f32c5434854eac54e31
Author: Jürg Billeter <j bitron ch>
Date:   Fri Sep 25 13:22:29 2009 +0200

    Fix static owned delegate fields

 codegen/valaccodebasemodule.vala |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index cd7dae6..b7e1655 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -968,6 +968,17 @@ internal class Vala.CCodeBaseModule : CCodeModule {
 					cdecl.modifiers = CCodeModifiers.EXTERN;
 				}
 				decl_space.add_type_member_declaration (cdecl);
+
+				if (delegate_type.value_owned) {
+					cdecl = new CCodeDeclaration ("GDestroyNotify");
+					cdecl.add_declarator (new CCodeVariableDeclarator (get_delegate_target_destroy_notify_cname  (f.get_cname ())));
+					if (f.is_private_symbol ()) {
+						cdecl.modifiers = CCodeModifiers.STATIC;
+					} else {
+						cdecl.modifiers = CCodeModifiers.EXTERN;
+					}
+					decl_space.add_type_member_declaration (cdecl);
+				}
 			}
 		}
 	}
@@ -1111,6 +1122,18 @@ internal class Vala.CCodeBaseModule : CCodeModule {
 						target_def.modifiers = CCodeModifiers.STATIC;
 					}
 					source_declarations.add_type_member_declaration (target_def);
+
+					if (delegate_type.value_owned) {
+						var target_destroy_notify_def = new CCodeDeclaration ("GDestroyNotify");
+						target_destroy_notify_def.add_declarator (new CCodeVariableDeclarator (get_delegate_target_destroy_notify_cname  (f.get_cname ()), new CCodeConstant ("NULL")));
+						if (!f.is_private_symbol ()) {
+							target_destroy_notify_def.modifiers = CCodeModifiers.EXTERN;
+						} else {
+							target_destroy_notify_def.modifiers = CCodeModifiers.STATIC;
+						}
+						source_declarations.add_type_member_declaration (target_destroy_notify_def);
+
+					}
 				}
 			}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]