=?utf-8?q?=5Bperl-Glib-Object-Introspection=5D_Implement_SV_=E2=86=92_GEr?= =?utf-8?q?ror?=



commit a00774b7777f51e06722a264ccc513bd7c44bb80
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Thu Feb 14 21:16:58 2013 +0100

    Implement SV â GError

 NEWS                     |    1 +
 gperl-i11n-marshal-arg.c |   11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index de1b872..108f751 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 Overview of changes in Glib::Object::Introspection <next>
 ========================================================
 
+* Allow Perl code to return Glib::Error objects.
 * Register error domains.
 
 Overview of changes in Glib::Object::Introspection 0.014
diff --git a/gperl-i11n-marshal-arg.c b/gperl-i11n-marshal-arg.c
index f2d87c2..539b7e3 100644
--- a/gperl-i11n-marshal-arg.c
+++ b/gperl-i11n-marshal-arg.c
@@ -115,7 +115,16 @@ sv_to_arg (SV * sv,
                break;
 
            case GI_TYPE_TAG_ERROR:
-               ccroak ("FIXME - A GError as an in/inout arg?  Should never happen!");
+               if (gperl_sv_is_ref (sv)) {
+                       gperl_gerror_from_sv (sv, (GError **) &arg->v_pointer);
+                       g_assert (transfer == GI_TRANSFER_EVERYTHING);
+               } else if (gperl_sv_is_defined (sv)) {
+                       arg->v_pointer = NULL;
+                       g_set_error ((GError **) &arg->v_pointer, 0, 0, "%s", SvPV_nolen (sv));
+                       g_assert (transfer == GI_TRANSFER_EVERYTHING);
+               } else {
+                       arg->v_pointer = NULL;
+               }
                break;
 
            case GI_TYPE_TAG_UTF8:


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