Merge branch 'leaks' into 'main'

Fix GIOModule regression from !2959

See merge request GNOME/glib!2970
This commit is contained in:
Philip Withnall 2022-10-18 11:06:40 +00:00
commit 47ab384fd9

View File

@ -579,11 +579,17 @@ g_io_modules_scan_all_in_directory_with_scope (const char *dirname,
{ {
/* Try to load and init types */ /* Try to load and init types */
if (g_type_module_use (G_TYPE_MODULE (module))) if (g_type_module_use (G_TYPE_MODULE (module)))
{
g_type_module_unuse (G_TYPE_MODULE (module)); /* Unload */ g_type_module_unuse (G_TYPE_MODULE (module)); /* Unload */
/* module must remain alive, because the type system keeps weak refs */
g_ignore_leak (module);
}
else else
{
g_printerr ("Failed to load module: %s\n", path); g_printerr ("Failed to load module: %s\n", path);
g_object_unref (module); g_object_unref (module);
} }
}
g_free (path); g_free (path);
} }