File: gtype-Define-copy-and-free-functions-for-GTypeClass-and-G.patch

package info (click to toggle)
glib2.0 2.86.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 73,060 kB
  • sloc: ansic: 544,382; python: 9,702; sh: 1,612; xml: 1,482; perl: 1,222; cpp: 535; makefile: 321; javascript: 11
file content (47 lines) | stat: -rw-r--r-- 1,563 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Wed, 10 Sep 2025 02:40:03 +0200
Subject: gtype: Define copy and free functions for GTypeClass and
 GTypeInterface

We have some (deprecated) methods that technically still return
transfer-full instances of GTypeClass's and GTypeInterface's.

The introspection scanner cannot generate bindings for them though since
it does not know how to manage their lifecycle, and we end up skipping
these symbols.

This is breaking some language bindings, and in particular gjs [1] and
lua-lgi, that were using the .ref methods.

While we should not use deprecated functions in the language bindings,
these symbols should still be introspected.

[1] https://gitlab.gnome.org/GNOME/gjs/-/issues/711

Forwarded: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4792
---
 gobject/gtype.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gobject/gtype.h b/gobject/gtype.h
index fcb176d..a083042 100644
--- a/gobject/gtype.h
+++ b/gobject/gtype.h
@@ -444,7 +444,7 @@ typedef struct _GTypeQuery		GTypeQuery;
 /* Basic Type Structures
  */
 /**
- * GTypeClass:
+ * GTypeClass: (copy-func g_type_class_ref) (free-func g_type_class_unref)
  * 
  * An opaque structure used as the base of all classes.
  */
@@ -464,7 +464,7 @@ struct _GTypeInstance
   GTypeClass *g_class;
 };
 /**
- * GTypeInterface:
+ * GTypeInterface: (copy-func g_type_default_interface_ref) (free-func g_type_default_interface_unref)
  * 
  * An opaque structure used as the base of all interface types.
  */