Enlightenment CVS committal Author : rbdpngn Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_text.c Log Message: Fixup some of the destroy/free cases for the triggers to use the garbage collection and automatic destroy features present. Remove stale references from the parent text to a trigger. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_text.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -3 -r1.50 -r1.51 --- ewl_text.c 16 Nov 2005 04:26:09 -0000 1.50 +++ ewl_text.c 17 Nov 2005 06:42:53 -0000 1.51 @@ -2005,7 +2005,8 @@ DRETURN(DLEVEL_STABLE); while ((trig = ecore_list_remove_first(t->triggers))) { - ewl_text_trigger_free(trig); + trig->text_parent = NULL; + ewl_widget_destroy(EWL_WIDGET(trig)); } DLEAVE_FUNCTION(DLEVEL_STABLE); @@ -2078,9 +2079,9 @@ DCHECK_PARAM_PTR_RET("trigger", trigger, FALSE); if (type == EWL_TEXT_TRIGGER_TYPE_TRIGGER) - type_str = strdup("trigger"); + type_str = "trigger"; else if (type == EWL_TEXT_TRIGGER_TYPE_SELECTION) - type_str = strdup("selection"); + type_str = "selection"; else { DRETURN_INT(FALSE, DLEVEL_STABLE); @@ -2090,30 +2091,41 @@ { DRETURN_INT(FALSE, DLEVEL_STABLE); } + ewl_widget_appearance_set(EWL_WIDGET(trigger), type_str); ewl_widget_inherit(EWL_WIDGET(trigger), "trigger"); + ewl_callback_prepend(EWL_WIDGET(trigger), EWL_CALLBACK_DESTROY, + ewl_text_trigger_cb_destroy, NULL); + trigger->areas = ecore_list_new(); trigger->type = type; - FREE(type_str); - DRETURN_INT(TRUE, DLEVEL_STABLE); } void -ewl_text_trigger_free(Ewl_Text_Trigger *t) +ewl_text_trigger_cb_destroy(Ewl_Widget *w, void *ev_data, void *user_data) { + Ewl_Text_Trigger *t; + DENTER_FUNCTION(DLEVEL_STABLE); - DCHECK_PARAM_PTR("t", t); - DCHECK_TYPE("t", t, "trigger"); + DCHECK_PARAM_PTR("w", w); + DCHECK_TYPE("w", w, "trigger"); + + t = EWL_TEXT_TRIGGER(w); if (t->areas) ecore_list_destroy(t->areas); + if (t->text_parent) { + if (ecore_list_goto(t->text_parent->triggers, t)) + ecore_list_remove(t->text_parent->triggers); + } + t->text_parent = NULL; t->areas = NULL; - FREE(t); + ewl_widget_destroy(EWL_WIDGET(t)); DLEAVE_FUNCTION(DLEVEL_STABLE); } @@ -3093,8 +3105,10 @@ void ewl_text_context_shutdown(void) { - if (context_hash) + if (context_hash) { ecore_hash_destroy(context_hash); + context_hash = NULL; + } } static char * ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit: http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs