new file mode 100644
@@ -0,0 +1,40 @@
+From 3da1eaaa891b7dfdba57b16c079ff8c6100ebb45 Mon Sep 17 00:00:00 2001
+From: Frederic Martinsons <frederic.martinsons@gmail.com>
+Date: Fri, 15 Jan 2021 07:24:37 +0100
+Subject: [PATCH] Workaround to fix the invocation object leaks
+
+See https://gitlab.gnome.org/GNOME/pygobject/-/issues/307 for description
+
+Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
+---
+ gi/pygi-object.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/gi/pygi-object.c b/gi/pygi-object.c
+index 00b36c1b..5ca45975 100644
+--- a/gi/pygi-object.c
++++ b/gi/pygi-object.c
+@@ -213,8 +213,18 @@ _pygi_marshal_cleanup_from_py_interface_object (PyGIInvokeState *state,
+ /* If we processed the parameter but fail before invoking the method,
+ we need to remove the ref we added */
+ if (was_processed && state->failed && data != NULL &&
+- arg_cache->transfer == GI_TRANSFER_EVERYTHING)
++ arg_cache->transfer == GI_TRANSFER_EVERYTHING) {
+ g_object_unref (G_OBJECT(data));
++ return;
++ }
++
++ /* BAD hack to solve https://gitlab.gnome.org/GNOME/pygobject/-/issues/307 */
++ if (was_processed && data != NULL && arg_cache->transfer == GI_TRANSFER_EVERYTHING) {
++ GObject* obj = G_OBJECT(data);
++ if (!g_strcmp0(G_OBJECT_TYPE_NAME(obj), "GDBusMethodInvocation") && obj->ref_count > 1) {
++ g_object_unref (G_OBJECT(data));
++ }
++ }
+ }
+
+
+--
+2.25.1
+
+
@@ -17,6 +17,7 @@ SRCNAME="pygobject"
SRC_URI = " \
http://ftp.gnome.org/pub/GNOME/sources/${SRCNAME}/${@gnome_verdir("${PV}")}/${SRCNAME}-${PV}.tar.xz \
file://0001-Do-not-build-tests.patch \
+ file://0002-workaround-to-fix-the-invocation-object-leaks.patch \
"
SRC_URI[sha256sum] = "9b12616e32cfc792f9dc841d9c472a41a35b85ba67d3a6eb427e307a6fe4367b"