2008-04-18 Jürg Billeter <j@bitron.ch>
+ * vala/valaclass.vala, gobject/valaccodegeneratorclass.vala: make
+ sure that ref_function and unref_function of classes deriving
+ from GTypeInstance are always initialized
+
+2008-04-18 Jürg Billeter <j@bitron.ch>
+
* vala/valaparser.vala: ensure all classes have a default
construction method
source_type_member_definition.append (ref_fun);
source_type_member_definition.append (unref_fun);
-
- cl.set_ref_function (ref_fun.name);
- cl.set_unref_function (unref_fun.name);
}
} else if (!cl.is_static) {
var function = new CCodeFunction (cl.get_lower_case_cprefix () + "free", "void");
public override bool is_reference_counting () {
return get_ref_function () != null;
}
-
+
+ bool is_fundamental () {
+ if (base_class != null
+ && base_class.name == "TypeInstance"
+ && base_class.parent_symbol.name == "GLib") {
+ return true;
+ }
+ return false;
+ }
+
public override string? get_ref_function () {
+ if (ref_function == null && is_fundamental ()) {
+ ref_function = get_lower_case_cprefix () + "ref";
+ }
+
if (ref_function == null && base_class != null) {
return base_class.get_ref_function ();
} else {
}
public override string? get_unref_function () {
+ if (unref_function == null && is_fundamental ()) {
+ unref_function = get_lower_case_cprefix () + "unref";
+ }
+
if (unref_function == null && base_class != null) {
return base_class.get_unref_function ();
} else {