From 8bba92fbca7c721a7582b098698404e491f44941 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Tue, 26 Nov 2013 12:16:22 +0000 Subject: [PATCH] Evas object: Set manual_free to false once obj is detached from canvas. This means unref will really free the object instead of just let it linger in memory once the object is unrefed. This is also correct because once detached from the canvas, Evas has nothing to do with the object and it shouldn't need the manual free anymore. --- src/lib/evas/canvas/evas_object_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index 233bd416cf..24386afc25 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -196,7 +196,11 @@ evas_object_free(Evas_Object *eo_obj, int clean_layer) eina_cow_free(evas_object_state_cow, (const Eina_Cow_Data**) &obj->prev); eo_data_unref(eo_obj, obj->private_data); obj->private_data = NULL; - eo_manual_free(eo_obj); + + /* Try to manual free, and if it fails, unset it so the next unref will + * actually free the object. */ + if (!eo_manual_free(eo_obj)) + eo_manual_free_set(eo_obj, EINA_FALSE); } void