Commit 77edd178 authored by Mathias Hasselmann's avatar Mathias Hasselmann Committed by Mathias Hasselmann
Browse files

avoid crash on missing copy function, fixes bug 471063.

2007-08-28  Mathias Hasselmann  <mathias.hasselmann@gmx.de>

	* gobject/valacodegenerator.vala: avoid crash on missing copy
	function, fixes bug 471063.

svn path=/trunk/; revision=520
parent ef2f64dd
2007-08-28 Mathias Hasselmann <mathias.hasselmann@gmx.de>
* gobject/valacodegenerator.vala: avoid crash on missing copy
function, fixes bug 471063.
2007-08-28 Marc-Andre Lureau <marcandre.lureau@gmail.com>
* doc/Makefile.am, doc/gidlgen.1, doc/vapigen.1:
......
......@@ -955,7 +955,11 @@ public class Vala.CodeGenerator : CodeVisitor {
Report.error (type.data_type.source_reference, "The type `%s` doesn't contain a copy function".printf (type.data_type.get_full_name ()));
}
}
if (null != dup_function)
return new CCodeIdentifier (dup_function);
return null;
} else if (type.type_parameter != null && current_type_symbol is Class) {
string func_name = "%s_dup_func".printf (type.type_parameter.name.down ());
return new CCodeMemberAccess.pointer (new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), "priv"), func_name);
......@@ -2245,7 +2249,13 @@ public class Vala.CodeGenerator : CodeVisitor {
* if static type of expr is non-null
*/
var ccall = new CCodeFunctionCall (get_dup_func_expression (expr.static_type));
var dupexpr = get_dup_func_expression (expr.static_type);
if (null == dupexpr) {
return null;
}
var ccall = new CCodeFunctionCall (dupexpr);
if (expr.static_type.non_null && expr.static_type.type_parameter == null) {
ccall.add_argument ((CCodeExpression) expr.ccodenode);
......
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