Commit 3e4156ad authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

make sure that ref_function and unref_function of classes deriving from

2008-04-18  Juerg 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

svn path=/trunk/; revision=1255
parent d3be9f85
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
......
......@@ -238,9 +238,6 @@ public class Vala.CCodeGenerator {
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");
......
......@@ -598,8 +598,21 @@ public class Vala.Class : Typesymbol {
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 {
......@@ -612,6 +625,10 @@ public class Vala.Class : Typesymbol {
}
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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment