From 6491067714227874f3518d0de626dcee9922205b Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Sat, 29 Dec 2012 13:45:38 +0000 Subject: [PATCH] terminology: fix termio's Evas_Smart_Class inheritance usage. - _smart_add(): if you set the smart data before clipped smart object constructor, it will reuse that. No need to get, copy, free then reset. - _smart_del(): clipped smart object will free(sd) already, no need to do it again (double free). SVN revision: 81869 --- src/bin/termio.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/bin/termio.c b/src/bin/termio.c index 5ee30b4e..02186652 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -2150,19 +2150,15 @@ static void _smart_add(Evas_Object *obj) { Termio *sd; - Evas_Object_Smart_Clipped_Data *cd; Evas_Object *o; int i, j, k, l, n; - _parent_sc.add(obj); - cd = evas_object_smart_data_get(obj); - if (!cd) return; sd = calloc(1, sizeof(Termio)); - if (!sd) return; - sd->__clipped_data = *cd; - free(cd); + EINA_SAFETY_ON_NULL_RETURN(sd); evas_object_smart_data_set(obj, sd); + _parent_sc.add(obj); + /* Terminal output widget */ o = evas_object_textgrid_add(evas_object_evas_get(obj)); evas_object_pass_events_set(o, EINA_TRUE); @@ -2347,8 +2343,6 @@ _smart_del(Evas_Object *obj) termpty_shutdown(); _parent_sc.del(obj); - evas_object_smart_data_set(obj, NULL); - free(sd); } static void