Control: tags -1 + patch

On Sat, 14 Sep 2024 at 01:24:28 +0100, Simon McVittie wrote:
> libglib-object-introspection-perl's autopkgtests fail when testing against
> gobject-introspection 1.81.x in experimental

Please consider the attached patch, as proposed upstream by a
gobject-introspection maintainer. Also available as a merge request:
https://salsa.debian.org/perl-team/modules/packages/libglib-object-introspection-perl/-/merge_requests/1

It passes tests with the old gobject-introspection (1.80.x in
testing/unstable) and also with the new version (1.81.x in experimental).

I haven't done any manual testing with dependent packages: I don't know
which ones, if any, use this particular pattern.

Thanks,
    smcv
From: Emmanuele Bassi <eba...@gnome.org>
Date: Sat, 14 Sep 2024 13:09:59 +0100
Subject: Handle pointer types

Now that gobject-introspection pairs G_TYPE_POINTER types with their
type registration function, we need to handle the case in which we are
passed a pointer to a record that inherits from G_TYPE_POINTER. Since
these types are basically plain pointers, we can reuse the sv_to_struct
and struct_to_sv functions we use for untyped structures.

Bug: https://gitlab.gnome.org/GNOME/perl-glib-object-introspection/-/issues/7
Bug-Debian: https://bugs.debian.org/1081701
Forwarded: https://gitlab.gnome.org/GNOME/perl-glib-object-introspection/-/merge_requests/12
---
 gperl-i11n-marshal-interface.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/gperl-i11n-marshal-interface.c b/gperl-i11n-marshal-interface.c
index 2bef8eb..50cce51 100644
--- a/gperl-i11n-marshal-interface.c
+++ b/gperl-i11n-marshal-interface.c
@@ -41,6 +41,12 @@ instance_sv_to_pointer (GICallableInfo *info, SV *sv, GPerlI11nInvocationInfo *i
 				                        info_type,
 				                        sv);
 			}
+                } else if (g_type_is_a (type, G_TYPE_POINTER)) {
+                        dwarn ("  -> pointer\n");
+                        pointer = sv_to_struct (GI_TRANSFER_NOTHING,
+                                                container,
+                                                info_type,
+                                                sv);
 		} else {
 			dwarn ("  -> boxed: type=%s (%"G_GSIZE_FORMAT")\n",
 			       g_type_name (type), type);
@@ -397,6 +403,12 @@ interface_to_sv (GITypeInfo* info,
 			}
 		}
 
+                else if (g_type_is_a (type, G_TYPE_POINTER)) {
+                        dwarn ("  -> pointer: pointer=%p, type=%"G_GSIZE_FORMAT" (%s), own=%d\n",
+                               arg->v_pointer, type, g_type_name (type), own);
+			sv = struct_to_sv (interface, info_type, arg->v_pointer, own);
+                }
+
 #if GLIB_CHECK_VERSION (2, 24, 0)
 		else if (g_type_is_a (type, G_TYPE_VARIANT)) {
 			dwarn ("  -> variant\n");

Reply via email to