[vala] girwriter: Fix indices for delegate parameters



commit 9a08ed877123509747d288e649544b0289b1674f
Author: Michal Hruby <michal mhr gmail com>
Date:   Sat Jan 22 17:45:53 2011 +0100

    girwriter: Fix indices for delegate parameters

 codegen/valagirwriter.vala |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 336972e..60ab49e 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -928,9 +928,11 @@ public class Vala.GIRWriter : CodeVisitor {
 		}
 
 		if (delegate_type != null && delegate_type.delegate_symbol.has_target) {
-			buffer.append_printf (" closure=\"%i\"", index + 1);
+			int closure_index = is_parameter ?
+				index + 1 : (type.value_owned ? index - 1 : index);
+			buffer.append_printf (" closure=\"%i\"", closure_index);
 			if (type.value_owned) {
-				buffer.append_printf (" destroy=\"%i\"", index + 2);
+				buffer.append_printf (" destroy=\"%i\"", closure_index + 1);
 			}
 		}
 



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