[perl-Glib-Object-Introspection] Allow wrapped C callbacks to return values



commit 56c540cbae4aaf4c332f6a29b02d39e45d26a05e
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Fri Jan 25 17:22:02 2013 +0100

    Allow wrapped C callbacks to return values

 GObjectIntrospection.xs |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/GObjectIntrospection.xs b/GObjectIntrospection.xs
index 20e6236..3c34fdc 100644
--- a/GObjectIntrospection.xs
+++ b/GObjectIntrospection.xs
@@ -990,7 +990,7 @@ _invoke (SV *code, ...)
     PREINIT:
 	GPerlI11nCCallbackInfo *wrapper;
 	UV internal_stack_offset = 1;
-    CODE:
+    PPCODE:
 	wrapper = INT2PTR (GPerlI11nCCallbackInfo*, SvIV (SvRV (code)));
 	if (!wrapper || !wrapper->func)
 		ccroak ("invalid reference encountered");
@@ -998,6 +998,10 @@ _invoke (SV *code, ...)
 	               sp, ax, mark, items,
 	               internal_stack_offset,
 	               NULL, NULL, NULL);
+	/* SPAGAIN since invoke_c_code probably modified the stack
+	 * pointer.  so we need to make sure that our local variable
+	 * 'sp' is correct before the implicit PUTBACK happens. */
+	SPAGAIN;
 
 void
 DESTROY (SV *code)



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