This is an automated email from the git hooks/post-receive script. intrigeri pushed a commit to branch experimental in repository libglib-object-introspection-perl.
commit d9b10c1501ae03988a2ec3856fb326cb35c12ebb Author: intrigeri <intrig...@boum.org> Date: Fri Mar 13 11:31:49 2015 +0000 Imported Upstream version 0.028 --- GObjectIntrospection.xs | 10 +++--- META.json | 4 +-- META.yml | 4 +-- NEWS | 18 +++++++++++ gperl-i11n-field.c | 66 ++++++++++++++++++++++++++-------------- gperl-i11n-invoke-c.c | 23 ++++++++++++-- gperl-i11n-invoke-perl.c | 2 +- gperl-i11n-marshal-arg.c | 9 ------ lib/Glib/Object/Introspection.pm | 2 +- t/enums.t | 4 +-- 10 files changed, 94 insertions(+), 48 deletions(-) diff --git a/GObjectIntrospection.xs b/GObjectIntrospection.xs index afcc98a..3ed829d 100644 --- a/GObjectIntrospection.xs +++ b/GObjectIntrospection.xs @@ -397,7 +397,7 @@ _register_types (class, namespace, package) info_type = g_base_info_get_type (info); name = g_base_info_get_name (info); - dwarn ("setting up %s.%s\n", namespace, name); + dwarn ("setting up %s::%s\n", namespace, name); if (info_type == GI_INFO_TYPE_CONSTANT) { av_push (constants, newSVpv (name, 0)); @@ -448,7 +448,7 @@ _register_types (class, namespace, package) type = get_gtype ((GIRegisteredTypeInfo *) info); if (!type) { - ccroak ("Could not find GType for type %s::%s", + ccroak ("Could not find GType for type %s%s", namespace, name); } if (type == G_TYPE_NONE) { @@ -543,7 +543,7 @@ _register_boxed_synonym (class, const gchar *reg_basename, const gchar *reg_name reg_info = g_irepository_find_by_name (repository, reg_basename, reg_name); reg_type = reg_info ? get_gtype (reg_info) : 0; if (!reg_type) - ccroak ("Could not lookup GType for type %s.%s", + ccroak ("Could not lookup GType for type %s%s", reg_basename, reg_name); /* The GType in question (e.g., GdkRectangle) hasn't been loaded yet, @@ -759,7 +759,7 @@ _install_overrides (class, basename, object_name, target_package) GType gtype; gpointer klass; CODE: - dwarn ("_install_overrides: %s.%s for %s\n", + dwarn ("_install_overrides: %s%s for %s\n", basename, object_name, target_package); repository = g_irepository_get_default (); info = g_irepository_find_by_name (repository, basename, object_name); @@ -856,7 +856,7 @@ _invoke_fallback_vfunc (class, vfunc_package, vfunc_name, target_package, ...) gint field_offset; gpointer func_pointer; PPCODE: - dwarn ("_invoke_fallback_vfunc: %s.%s, target = %s\n", + dwarn ("_invoke_fallback_vfunc: %s::%s, target = %s\n", vfunc_package, vfunc_name, target_package); gtype = gperl_object_type_from_package (target_package); klass = g_type_class_peek (gtype); diff --git a/META.json b/META.json index cb10c60..f603c4b 100644 --- a/META.json +++ b/META.json @@ -4,7 +4,7 @@ "Glib::Object::Introspection Team <gtk-perl-list at gnome dot org>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141520", + "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.143240", "license" : [ "lgpl_2_1" ], @@ -66,5 +66,5 @@ "x_IRC" : "irc://irc.gimp.org/#gtk-perl", "x_MailingList" : "https://mail.gnome.org/mailman/listinfo/gtk-perl-list" }, - "version" : "0.025" + "version" : "0.028" } diff --git a/META.yml b/META.yml index 04528d0..49855da 100644 --- a/META.yml +++ b/META.yml @@ -10,7 +10,7 @@ configure_requires: ExtUtils::PkgConfig: '1' Glib: '1.28' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141520' +generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.143240' license: lgpl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -36,4 +36,4 @@ resources: homepage: http://gtk2-perl.sourceforge.net license: http://www.gnu.org/licenses/lgpl-2.1.html repository: git://git.gnome.org/perl-Glib-Object-Introspection -version: '0.025' +version: '0.028' diff --git a/NEWS b/NEWS index 6421b3f..5c760e3 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,21 @@ +Overview of changes in Glib::Object::Introspection 0.028 +======================================================== + +* Harmonize the format of type names in error messages +* Add a FIXME about a corner case of GInitiallyUnowned handling + +Overview of changes in Glib::Object::Introspection 0.027 +======================================================== + +* Fix compilation problems when NOISY is defined +* Move the handling of void record fields into the field accessors +* Rename a few variables for clarity + +Overview of changes in Glib::Object::Introspection 0.026 +======================================================== + +* Fix t/enums.t for older versions of Test::More + Overview of changes in Glib::Object::Introspection 0.025 ======================================================== diff --git a/gperl-i11n-field.c b/gperl-i11n-field.c index 39de231..e43c731 100644 --- a/gperl-i11n-field.c +++ b/gperl-i11n-field.c @@ -55,31 +55,52 @@ static SV * get_field (GIFieldInfo *field_info, gpointer mem, GITransfer transfer) { GITypeInfo *field_type; + GITypeTag field_tag; GIBaseInfo *interface_info; + GIInfoType interface_type; GIArgument value; SV *sv = NULL; field_type = g_field_info_get_type (field_info); + field_tag = g_type_info_get_tag (field_type); interface_info = g_type_info_get_interface (field_type); + interface_type = interface_info + ? g_base_info_get_type (interface_info) + : GI_INFO_TYPE_INVALID; - /* This case is not handled by g_field_info_set_field. */ + /* Non-pointer structs are not handled by g_field_info_get_field. */ if (!g_type_info_is_pointer (field_type) && - g_type_info_get_tag (field_type) == GI_TYPE_TAG_INTERFACE && - g_base_info_get_type (interface_info) == GI_INFO_TYPE_STRUCT) + field_tag == GI_TYPE_TAG_INTERFACE && + interface_type == GI_INFO_TYPE_STRUCT) { - gint offset; - offset = g_field_info_get_offset (field_info); - value.v_pointer = mem + offset; + gint offset = g_field_info_get_offset (field_info); + value.v_pointer = G_STRUCT_MEMBER_P (mem, offset); sv = arg_to_sv (&value, field_type, GI_TRANSFER_NOTHING, NULL); - } else if (g_field_info_get_field (field_info, mem, &value)) { + } + + /* Neither are void pointers. We retrieve the RV to the SV that + * set_field put into them. */ + else if (field_tag == GI_TYPE_TAG_VOID && + g_type_info_is_pointer (field_type)) + { + gint offset = g_field_info_get_offset (field_info); + value.v_pointer = G_STRUCT_MEMBER (gpointer, mem, offset); + sv = value.v_pointer + ? newRV (value.v_pointer) + : &PL_sv_undef; + } + + else if (g_field_info_get_field (field_info, mem, &value)) { sv = arg_to_sv (&value, field_type, transfer, NULL); - } else { + } + + else { ccroak ("Could not get field '%s'", g_base_info_get_name (field_info)); } @@ -95,21 +116,21 @@ static void set_field (GIFieldInfo *field_info, gpointer mem, GITransfer transfer, SV *sv) { GITypeInfo *field_type; + GITypeTag field_tag; GIBaseInfo *interface_info; - GITypeTag tag; - GIInfoType info_type; + GIInfoType interface_type; GIArgument arg; field_type = g_field_info_get_type (field_info); - tag = g_type_info_get_tag (field_type); + field_tag = g_type_info_get_tag (field_type); interface_info = g_type_info_get_interface (field_type); - info_type = interface_info + interface_type = interface_info ? g_base_info_get_type (interface_info) : GI_INFO_TYPE_INVALID; /* Structs are not handled by g_field_info_set_field. */ - if (tag == GI_TYPE_TAG_INTERFACE && - info_type == GI_INFO_TYPE_STRUCT) + if (field_tag == GI_TYPE_TAG_INTERFACE && + interface_type == GI_INFO_TYPE_STRUCT) { /* FIXME: No GIArgInfo and no GPerlI11nInvocationInfo here. * What if the struct contains an object pointer, or a callback @@ -122,10 +143,10 @@ set_field (GIFieldInfo *field_info, gpointer mem, GITransfer transfer, SV *sv) * 'mem' */ arg.v_pointer = sv_to_struct (GI_TRANSFER_NOTHING, interface_info, - info_type, + interface_type, sv); size = g_struct_info_get_size (interface_info); - g_memmove (mem + offset, arg.v_pointer, size); + g_memmove (G_STRUCT_MEMBER_P (mem, offset), arg.v_pointer, size); } else { /* Pointer */ GType gtype = get_gtype (interface_info); if (g_type_is_a (gtype, G_TYPE_BOXED)) { @@ -150,22 +171,21 @@ set_field (GIFieldInfo *field_info, gpointer mem, GITransfer transfer, SV *sv) G_STRUCT_MEMBER (gpointer, mem, offset) = sv_to_struct (GI_TRANSFER_NOTHING, interface_info, - info_type, + interface_type, sv); } } } /* Neither are void pointers. We put an RV to the SV into them, which - * goes hand in hand with what get_field() is doing above via - * arg_to_sv(). */ - else if (tag == GI_TYPE_TAG_VOID && + * goes hand in hand with what get_field() is doing above. */ + else if (field_tag == GI_TYPE_TAG_VOID && g_type_info_is_pointer (field_type)) { gint offset = g_field_info_get_offset (field_info); - sv_to_arg (sv, &arg, NULL, field_type, - transfer, TRUE, NULL); - G_STRUCT_MEMBER (gpointer, mem, offset) = arg.v_pointer; + if (!gperl_sv_is_ref (sv)) + ccroak ("Can only put references into void fields"); + G_STRUCT_MEMBER (gpointer, mem, offset) = SvRV (sv); } else { diff --git a/gperl-i11n-invoke-c.c b/gperl-i11n-invoke-c.c index b8509d0..80ac875 100644 --- a/gperl-i11n-invoke-c.c +++ b/gperl-i11n-invoke-c.c @@ -350,8 +350,8 @@ _prepare_c_invocation_info (GPerlI11nCInvocationInfo *iinfo, dwarn ("C invoke: %s\n" " n_args: %d, n_invoke_args: %d, n_given_args: %d\n" " is_constructor: %d, is_method: %d\n", - iinfo->is_vfunc ? g_base_info_get_name (info) : g_function_info_get_symbol (info), - iinfo->n_args, iinfo->n_invoke_args, iinfo->n_given_args, + iinfo->base.is_vfunc ? g_base_info_get_name (info) : g_function_info_get_symbol (info), + iinfo->base.n_args, iinfo->n_invoke_args, iinfo->n_given_args, iinfo->is_constructor, iinfo->is_method); /* allocate enough space for all args in both the out and in lists. @@ -438,7 +438,24 @@ _prepare_c_invocation_info (GPerlI11nCInvocationInfo *iinfo, /* We need to undo the special handling that GInitiallyUnowned * descendants receive from gobject-introspection: values of this type - * are always marked transfer=none, even for constructors. */ + * are always marked transfer=none, even for constructors. + * + * FIXME: This is not correct for GtkWindow and its descendants, as + * gtk+ keeps an internal reference to each window. Hence, + * constructors like gtk_window_new return a non-floating object and do + * not pass ownership of a reference on to us. But the sink func + * currently registered for GInitiallyUnowned (sink_initially_unowned + * in GObject.xs in Glib) is actually inadvertently conforming to this + * requirement. It runs ref_sink+unref regardless of whether the + * object is floating or not. So, in the non-floating window case, it + * does nothing, resulting in an extra reference taken, despite the + * request to transfer ownership. + * + * If we ever encounter a constructor of a GInitiallyUnowned descendant + * that returns a non-floating object and passes ownership of a + * reference on to us, or a constructor of a GInitiallyUnowned + * descendant that returns a floating object but passes no reference on + * to us, then we need to revisit this. */ if (iinfo->is_constructor && g_type_info_get_tag (iinfo->base.return_type_info) == GI_TYPE_TAG_INTERFACE) { diff --git a/gperl-i11n-invoke-perl.c b/gperl-i11n-invoke-perl.c index 4eb6c33..c4b612d 100644 --- a/gperl-i11n-invoke-perl.c +++ b/gperl-i11n-invoke-perl.c @@ -367,7 +367,7 @@ _prepare_perl_invocation_info (GPerlI11nPerlInvocationInfo *iinfo, GITypeInfo *length_arg_type = iinfo->base.arg_types[pos]; raw_to_arg (args[pos], &iinfo->base.aux_args[pos], length_arg_type); dwarn (" pos %d is array length => %"G_GSIZE_FORMAT"\n", - pos, iinfo->aux_args[pos].v_size); + pos, iinfo->base.aux_args[pos].v_size); } } } diff --git a/gperl-i11n-marshal-arg.c b/gperl-i11n-marshal-arg.c index d14d2e5..ce41ee7 100644 --- a/gperl-i11n-marshal-arg.c +++ b/gperl-i11n-marshal-arg.c @@ -32,11 +32,6 @@ sv_to_arg (SV * sv, case GI_TYPE_TAG_VOID: /* returns NULL if no match is found */ arg->v_pointer = sv_to_callback_data (sv, invocation_info); - if (!arg->v_pointer && g_type_info_is_pointer (type_info) - && gperl_sv_is_ref (sv)) - { - arg->v_pointer = SvRV (sv); - } dwarn (" argument with no type information -> pointer %p\n", arg->v_pointer); break; @@ -168,10 +163,6 @@ arg_to_sv (GIArgument * arg, SV *sv = callback_data_to_sv (arg->v_pointer, iinfo); if (sv) { SvREFCNT_inc (sv); - } else { - if (arg->v_pointer && g_type_info_is_pointer (info)) { - sv = newRV (arg->v_pointer); - } } dwarn (" argument with no type information -> SV %p\n", sv); return sv ? sv : &PL_sv_undef; diff --git a/lib/Glib/Object/Introspection.pm b/lib/Glib/Object/Introspection.pm index dabe2d3..f1af35f 100644 --- a/lib/Glib/Object/Introspection.pm +++ b/lib/Glib/Object/Introspection.pm @@ -19,7 +19,7 @@ use strict; use warnings; use Glib; -our $VERSION = '0.025'; +our $VERSION = '0.028'; use Carp; $Carp::Internal{(__PACKAGE__)}++; diff --git a/t/enums.t b/t/enums.t index e5cecdd..707a4e7 100644 --- a/t/enums.t +++ b/t/enums.t @@ -9,12 +9,12 @@ plan tests => 4; is (Regress::test_enum_param ('value1'), 'value1'); is (Regress::test_unsigned_enum_param ('value2'), 'value2'); -ok (Regress::global_get_flags_out () == ['flag1', 'flag3']); +cmp_ok (Regress::global_get_flags_out (), '==', ['flag1', 'flag3']); SKIP: { skip 'non-GType flags tests', 1 unless (check_gi_version (0, 10, 3)); GI::no_type_flags_in ([qw/value2/]); - is (GI::no_type_flags_returnv (), [qw/value2/]); + cmp_ok (GI::no_type_flags_returnv (), '==', [qw/value2/]); } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libglib-object-introspection-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits