gitypelib: Switch to refcounting

Since `GITypelib` is exposed in the public libgirepository API, it needs
to be a boxed type. So we either need to add a `copy` method to mirror
the existing `free` method, or switch to refcounting. The latter option
seems better, since a `GITypelib` contains internal state about open
`GModule`s and the semantics for copying that would be potentially
complex.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
This commit is contained in:
Philip Withnall
2024-02-07 14:38:05 +00:00
parent 702719dee9
commit 5cc5f413f5
6 changed files with 54 additions and 26 deletions

View File

@@ -218,7 +218,7 @@ main (int argc, char **argv)
g_debug ("[building] start");
{
GITypelib *typelib;
GITypelib *typelib = NULL;
if (shlibs)
{
@@ -238,8 +238,8 @@ main (int argc, char **argv)
if (!write_out_typelib (NULL, typelib))
return 1;
gi_typelib_free (typelib);
typelib = NULL;
g_clear_pointer (&typelib, gi_typelib_unref);
}
g_debug ("[building] done");