mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-24 19:22:11 +01:00
gvarianttypeinfo: Mark one-off leaks as ignored
These two data structures are allocated once and live for the lifetime of the process, and are leaked on exit. That’s fine, and intentional. Add `g_ignore_leak()` to them to make that a bit clearer, and communicate the intent to asan. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: #3472
This commit is contained in:
parent
67532b4555
commit
0175b5ff12
@ -31,6 +31,7 @@
|
|||||||
#include <glib/ghash.h>
|
#include <glib/ghash.h>
|
||||||
#include <glib/grefcount.h>
|
#include <glib/grefcount.h>
|
||||||
|
|
||||||
|
#include "glib-private.h"
|
||||||
#include "glib_trace.h"
|
#include "glib_trace.h"
|
||||||
|
|
||||||
/* < private >
|
/* < private >
|
||||||
@ -800,8 +801,11 @@ g_variant_type_info_get (const GVariantType *type)
|
|||||||
g_rec_mutex_lock (&g_variant_type_info_lock);
|
g_rec_mutex_lock (&g_variant_type_info_lock);
|
||||||
|
|
||||||
if (g_variant_type_info_table == NULL)
|
if (g_variant_type_info_table == NULL)
|
||||||
|
{
|
||||||
g_variant_type_info_table = g_hash_table_new ((GHashFunc)_g_variant_type_hash,
|
g_variant_type_info_table = g_hash_table_new ((GHashFunc)_g_variant_type_hash,
|
||||||
(GEqualFunc)_g_variant_type_equal);
|
(GEqualFunc)_g_variant_type_equal);
|
||||||
|
g_ignore_leak (g_variant_type_info_table);
|
||||||
|
}
|
||||||
info = g_hash_table_lookup (g_variant_type_info_table, type_string);
|
info = g_hash_table_lookup (g_variant_type_info_table, type_string);
|
||||||
|
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
@ -895,7 +899,10 @@ g_variant_type_info_unref (GVariantTypeInfo *info)
|
|||||||
if (g_atomic_ref_count_dec (&container->ref_count))
|
if (g_atomic_ref_count_dec (&container->ref_count))
|
||||||
{
|
{
|
||||||
if (g_variant_type_info_gc == NULL)
|
if (g_variant_type_info_gc == NULL)
|
||||||
|
{
|
||||||
g_variant_type_info_gc = g_ptr_array_new ();
|
g_variant_type_info_gc = g_ptr_array_new ();
|
||||||
|
g_ignore_leak (g_variant_type_info_gc);
|
||||||
|
}
|
||||||
|
|
||||||
/* Steal this instance and place it onto the GC queue.
|
/* Steal this instance and place it onto the GC queue.
|
||||||
* We may bring it back to life before the next GC.
|
* We may bring it back to life before the next GC.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user