From 57f3e172ca0d9f2f109405231669b2b2302de6e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 26 Nov 2024 11:58:52 +0100 Subject: [PATCH] clutter/color-manager: Clear default_color_state in finalize Fixes leak: ==5763== 96 (32 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 10,901 of 13,065 ==5763== at 0x4F81D57: g_type_create_instance (gtype.c:1929) ==5763== by 0x4F64ABF: g_object_new_internal.part.0 (gobject.c:2606) ==5763== by 0x4F66ADD: g_object_new_internal (gobject.c:2603) ==5763== by 0x4F66ADD: g_object_new_with_properties (gobject.c:2769) ==5763== by 0x4F67A30: g_object_new (gobject.c:2415) ==5763== by 0x52F7C46: clutter_color_state_new_full (clutter-color-state.c:339) ==5763== by 0x52F7C03: clutter_color_state_new (clutter-color-state.c:312) ==5763== by 0x52F7110: clutter_color_manager_get_default_color_state (clutter-color-manager.c:150) ==5763== by 0x52E7543: get_default_color_state (clutter-actor.c:17836) ==5763== by 0x52E765D: clutter_actor_unset_color_state (clutter-actor.c:17864) ==5763== by 0x52CF056: clutter_actor_constructor (clutter-actor.c:5646) ==5763== by 0x4F64DD3: g_object_new_with_custom_constructor (gobject.c:2524) ==5763== by 0x4F67275: g_object_new_internal (gobject.c:2604) ==5763== by 0x4F67275: g_object_new_valist (gobject.c:2945) Fixes: 2693cac83a5c ("clutter/color-manager: Add a method to get the default color state") Part-of: --- clutter/clutter/clutter-color-manager.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clutter/clutter/clutter-color-manager.c b/clutter/clutter/clutter-color-manager.c index 4a291e478..684019914 100644 --- a/clutter/clutter/clutter-color-manager.c +++ b/clutter/clutter/clutter-color-manager.c @@ -57,6 +57,8 @@ clutter_color_manager_finalize (GObject *object) { ClutterColorManager *color_manager = CLUTTER_COLOR_MANAGER (object); + g_clear_object (&color_manager->default_color_state); + g_clear_pointer (&color_manager->snippet_cache, g_hash_table_unref); G_OBJECT_CLASS (clutter_color_manager_parent_class)->finalize (object);