Commit c44dc665 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

free lists of interfaces correctly, patch by Mathias Hasselmann

2007-03-20  Jürg Billeter  <j@bitron.ch>

	* vala/valacodegenerator.vala: free lists of interfaces correctly, patch
	  by Mathias Hasselmann

svn path=/trunk/; revision=244
parent 99255fc4
2007-03-20 Jürg Billeter <j@bitron.ch>
* vala/valacodegenerator.vala: free lists of interfaces correctly, patch
by Mathias Hasselmann
2007-03-17 Jürg Billeter <j@bitron.ch>
* compiler/valacompiler.vala, compiler/Makefile.am, vapi/config.vala:
......
......@@ -2152,16 +2152,18 @@ public class Vala.CodeGenerator : CodeVisitor {
if (unref_function == "g_list_free") {
bool is_ref = false;
bool is_class = false;
var type_args = type.get_type_arguments ();
foreach (TypeReference type_arg in type_args) {
is_ref = type_arg.takes_ownership;
is_class = type_arg.data_type is Class;
bool is_interface = false;
foreach (TypeReference type_arg in type.get_type_arguments ()) {
is_ref |= type_arg.takes_ownership;
is_class |= type_arg.data_type is Class;
is_interface |= type_arg.data_type is Interface;
}
if (is_ref) {
var cunrefcall = new CCodeFunctionCall (new CCodeIdentifier ("g_list_foreach"));
cunrefcall.add_argument (cvar);
if (is_class) {
if (is_class || is_interface) {
cunrefcall.add_argument (new CCodeIdentifier ("(GFunc) g_object_unref"));
} else {
cunrefcall.add_argument (new CCodeIdentifier ("(GFunc) g_free"));
......
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