summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Goldberg <zach@zachgoldberg.com>2010-04-20 22:34:15 -0400
committerZach Goldberg <zach@zachgoldberg.com>2010-04-20 22:37:57 -0400
commit77e818f218b91310cfc5a092755594bd839ea24d (patch)
tree2627e2f57b6c5a86e2e93522463bf1dce281fc9f
parent5b896b3f93ffc8ecc10871e7665ab4dd1c71e91c (diff)
downloadgobject-introspection-77e818f218b91310cfc5a092755594bd839ea24d.tar.gz
Add new tests for multiple callback calls during function invokation for scope call
https://bugzilla.gnome.org/show_bug.cgi?id=616354
-rw-r--r--gir/Everything-1.0-expected.gir13
-rw-r--r--gir/everything.c19
-rw-r--r--gir/everything.h1
3 files changed, 33 insertions, 0 deletions
diff --git a/gir/Everything-1.0-expected.gir b/gir/Everything-1.0-expected.gir
index 9f4a49d9..150505ec 100644
--- a/gir/Everything-1.0-expected.gir
+++ b/gir/Everything-1.0-expected.gir
@@ -1538,6 +1538,19 @@ call and can be released on return.">
</parameter>
</parameters>
</function>
+ <function name="test_multi_callback" c:identifier="test_multi_callback">
+ <return-value transfer-ownership="none">
+ <type name="int" c:type="int"/>
+ </return-value>
+ <parameters>
+ <parameter name="callback"
+ transfer-ownership="none"
+ allow-none="1"
+ scope="call">
+ <type name="TestCallback" c:type="TestCallback"/>
+ </parameter>
+ </parameters>
+ </function>
<function name="test_multi_double_args"
c:identifier="test_multi_double_args">
<return-value transfer-ownership="none">
diff --git a/gir/everything.c b/gir/everything.c
index 5e4aaaaa..8ebac9e4 100644
--- a/gir/everything.c
+++ b/gir/everything.c
@@ -1833,6 +1833,25 @@ test_callback (TestCallback callback)
}
/**
+ * test_multi_callback:
+ * @callback: (scope call) (allow-none):
+ *
+ **/
+int
+test_multi_callback (TestCallback callback)
+{
+ int sum = 0;
+ if (callback != NULL) {
+ sum += callback();
+ sum += callback();
+ }
+
+ return sum;
+}
+
+
+
+/**
* test_simple_callback:
* @callback: (scope call) (allow-none):
*
diff --git a/gir/everything.h b/gir/everything.h
index c20d88e3..75cee29e 100644
--- a/gir/everything.h
+++ b/gir/everything.h
@@ -335,6 +335,7 @@ typedef int (*TestCallbackUserData) (gpointer user_data);
void test_simple_callback (TestSimpleCallback callback);
int test_callback (TestCallback callback);
+int test_multi_callback (TestCallback callback);
int test_callback_user_data (TestCallbackUserData callback,
gpointer user_data);
int test_callback_destroy_notify (TestCallbackUserData callback,