[gobject-introspection] scanner: avoid crash when annotation explicitly changes 'self' argument



commit e0d54af03a9de674af11fe7b4b58859e000c777e
Author: Pavel Holejsovsky <pholejs src gnome org>
Date:   Tue Dec 21 16:21:02 2010 +0100

    scanner: avoid crash when annotation explicitly changes 'self' argument

 giscanner/maintransformer.py              |    2 +-
 tests/scanner/Annotation-1.0-expected.gir |    5 +++++
 tests/scanner/annotation.c                |    9 +++++++++
 tests/scanner/annotation.h                |    1 +
 4 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 5a9530b..bafff60 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -908,7 +908,7 @@ method or constructor of some type."""
 
         # A quick hack here...in the future we should catch C signature/GI signature
         # mismatches in a general way in finaltransformer
-        if first.type.ctype.count('*') != 1:
+        if first.type.ctype is not None and first.type.ctype.count('*') != 1:
             return False
 
         # Here we check both the c_symbol_prefix and (if that fails),
diff --git a/tests/scanner/Annotation-1.0-expected.gir b/tests/scanner/Annotation-1.0-expected.gir
index 6ee00f7..29c8bd6 100644
--- a/tests/scanner/Annotation-1.0-expected.gir
+++ b/tests/scanner/Annotation-1.0-expected.gir
@@ -263,6 +263,11 @@ each string needs to be freed.</doc>
           </type>
         </return-value>
       </method>
+      <method name="hidden_self" c:identifier="annotation_object_hidden_self">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
       <method name="in" c:identifier="annotation_object_in">
         <doc xml:whitespace="preserve">This is a test for in arguments</doc>
         <return-value transfer-ownership="none">
diff --git a/tests/scanner/annotation.c b/tests/scanner/annotation.c
index 4c25178..f7046e8 100644
--- a/tests/scanner/annotation.c
+++ b/tests/scanner/annotation.c
@@ -614,6 +614,15 @@ annotation_object_watch_full (AnnotationObject *object,
 }
 
 /**
+ * annotation_object_hidden_self:
+ * @object: (type AnnotationObject): A #AnnotationObject
+ **/
+void
+annotation_object_hidden_self (gpointer object)
+{
+}
+
+/**
  * annotation_init:
  * @argc: (inout): The number of args. 
  * @argv: (inout) (array length=argc): The arguments.
diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h
index b58aa81..e4c5de6 100644
--- a/tests/scanner/annotation.h
+++ b/tests/scanner/annotation.h
@@ -127,6 +127,7 @@ void     annotation_object_watch_full   (AnnotationObject *object,
                                          AnnotationForeachFunc func,
                                          gpointer user_data,
                                          GDestroyNotify destroy);
+void     annotation_object_hidden_self  (gpointer object);
 
 void     annotation_init                (int              *argc, 
 					 char           ***argv);



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