[vala/0.12] gdk-3.0: Fix gdk_window_destroy binding



commit bbc45d1a14735a5265aef8c097dac6b9cdef9904
Author: Jürg Billeter <j bitron ch>
Date:   Mon May 16 13:53:55 2011 +0200

    gdk-3.0: Fix gdk_window_destroy binding

 vala/valacodewriter.vala               |    4 ++++
 vala/valamemberaccess.vala             |    2 ++
 vala/valamethod.vala                   |    2 ++
 vapi/gdk-3.0.vapi                      |    1 +
 vapi/packages/gdk-3.0/gdk-3.0.metadata |    1 +
 vapigen/valagidlparser.vala            |    4 ++++
 6 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index 3eafe22..11c5871 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -1040,6 +1040,10 @@ public class Vala.CodeWriter : CodeVisitor {
 			write_indent ();
 			write_string ("[ReturnsModifiedPointer]");
 		}
+		if (m.get_attribute ("DestroysInstance") != null) {
+			write_indent ();
+			write_string ("[DestroysInstance]");
+		}
 		if (m.printf_format) {
 			write_indent ();
 			write_string ("[PrintfFormat]");
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 7f4b6df..180c335 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -734,6 +734,7 @@ public class Vala.MemberAccess : Expression {
 			if (instance && inner == null) {
 				inner = new MemberAccess (null, "this", source_reference);
 				inner.value_type = this_parameter.variable_type.copy ();
+				inner.value_type.value_owned = false;
 				inner.symbol_reference = this_parameter;
 			}
 
@@ -767,6 +768,7 @@ public class Vala.MemberAccess : Expression {
 
 				if (instance && base_method.parent_symbol is TypeSymbol) {
 					inner.target_type = context.analyzer.get_data_type_for_symbol ((TypeSymbol) base_method.parent_symbol);
+					inner.target_type.value_owned = base_method.this_parameter.variable_type.value_owned;
 				}
 			} else if (symbol_reference is Property) {
 				var prop = (Property) symbol_reference;
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index 82fca11..59ab103 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -497,6 +497,8 @@ public class Vala.Method : Subroutine {
 				get_error_types ().clear ();
 			} else if (a.name == "Experimental") {
 				process_experimental_attribute (a);
+			} else if (a.name == "DestroysInstance") {
+				this_parameter.variable_type.value_owned = true;
 			}
 		}
 	}
diff --git a/vapi/gdk-3.0.vapi b/vapi/gdk-3.0.vapi
index fba20d4..ff16587 100644
--- a/vapi/gdk-3.0.vapi
+++ b/vapi/gdk-3.0.vapi
@@ -320,6 +320,7 @@ namespace Gdk {
 		public void coords_to_parent (double x, double y, double parent_x, double parent_y);
 		public unowned Cairo.Surface create_similar_surface (Cairo.Content content, int width, int height);
 		public void deiconify ();
+		[DestroysInstance]
 		public void destroy ();
 		public void enable_synchronized_configure ();
 		public void end_paint ();
diff --git a/vapi/packages/gdk-3.0/gdk-3.0.metadata b/vapi/packages/gdk-3.0/gdk-3.0.metadata
index 27cca22..a27f9a2 100644
--- a/vapi/packages/gdk-3.0/gdk-3.0.metadata
+++ b/vapi/packages/gdk-3.0/gdk-3.0.metadata
@@ -136,6 +136,7 @@ gdk_window_at_pointer.win_x is_out="1"
 gdk_window_at_pointer.win_y is_out="1"
 gdk_window_constrain_size.new_width is_out="1"
 gdk_window_constrain_size.new_height is_out="1"
+gdk_window_destroy destroys_instance="1"
 gdk_window_get_decorations.decorations is_out="1"
 gdk_window_get_deskrelative_origin.x is_out="1"
 gdk_window_get_deskrelative_origin.y is_out="1"
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index ca185ee..14d8a2c 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -2033,6 +2033,10 @@ public class Vala.GIdlParser : CodeVisitor {
 					if (eval (nv[1]) == "1") {
 						return_type.value_owned = true;
 					}
+				} else if (nv[0] == "destroys_instance") {
+					if (eval (nv[1]) == "1") {
+						m.attributes.append (new Attribute ("DestroysInstance", m.source_reference));
+					}
 				} else if (nv[0] == "nullable") {
 					if (eval (nv[1]) == "1") {
 						return_type.nullable = true;



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