From ebd1d9d2245f208d5e52d135d22a64f6accf4566 Mon Sep 17 00:00:00 2001 From: Bruno Dilly Date: Tue, 19 Jun 2012 18:20:38 +0000 Subject: [PATCH] Elm: fix the widget event callback freeing Removes the event callback list within _smart_del. The current implementation does not care about the node data resulting on memory leaks. Here follows the valgrind log: 16 bytes in 1 blocks are definitely lost in loss record 11 of 168 at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x522EC34: elm_widget_event_callback_add (elm_widget.c:1996) by 0x5A7AA2B: _edje_emit_handle (edje_program.c:1322) by 0x5A766B6: _edje_message_queue_process (edje_message_queue.c:764) by 0x5A76856: _edje_job (edje_message_queue.c:160) by 0x628C02A: _ecore_job_event_handler (ecore_job.c:115) by 0x6288C1F: _ecore_event_call (ecore_private.h:319) by 0x628D09B: _ecore_main_loop_iterate_internal (ecore_main.c:1814) by 0x628D566: ecore_main_loop_begin (ecore_main.c:931) by 0x4023B0: elm_main (test.c:198) Patch by Leandro Dorileo SVN revision: 72498 --- src/lib/elm_widget.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 71c6b86..ae3167f 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -4715,6 +4715,7 @@ _smart_del(Evas_Object *obj) { Evas_Object *sobj; Elm_Translate_String_Data *ts; + Elm_Event_Cb_Data *ecb; ELM_WIDGET_DATA_GET(obj, sd); @@ -4756,7 +4757,10 @@ _smart_del(Evas_Object *obj) eina_stringshare_del(ts->string); free(ts); } - sd->event_cb = eina_list_free(sd->event_cb); /* should be empty anyway */ + + EINA_LIST_FREE(sd->event_cb, ecb) + free(ecb); + if (sd->style) eina_stringshare_del(sd->style); if (sd->theme) elm_theme_free(sd->theme); _if_focused_revert(obj, EINA_TRUE); -- 2.7.4