Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_mvc.c Log Message: - make sure we clean up the highlights when we free the selections - when we free the selection we delete the callback on the highlight as this will be called and can set the highlight of the next selection NULL. We still want this called when the highlight is destroyed outside of the selection. =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_mvc.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -3 -r1.27 -r1.28 --- ewl_mvc.c 18 Aug 2007 18:20:15 -0000 1.27 +++ ewl_mvc.c 19 Aug 2007 03:13:01 -0000 1.28 @@ -31,6 +31,7 @@ Ewl_Selection *sel, Ewl_Widget *w); static void ewl_mvc_cb_highlight_destroy(Ewl_Widget *w, void *ev, void *data); static void ewl_mvc_cb_sel_free(void *data); +static void ewl_mvc_selection_free(Ewl_Selection *sel); /** @@ -309,7 +310,7 @@ DRETURN(DLEVEL_STABLE); while ((sel = ecore_list_remove_first(mvc->selected))) - ewl_mvc_cb_sel_free(sel); + ewl_mvc_selection_free(sel); DLEAVE_FUNCTION(DLEVEL_STABLE); } @@ -719,7 +720,7 @@ idx = EWL_SELECTION_IDX(sel); if (ewl_mvc_selected_goto(mvc, idx->row, idx->column)) { - FREE(sel); + ewl_mvc_selection_free(sel); DRETURN(DLEVEL_STABLE); } @@ -748,7 +749,7 @@ * range and don't need to be re-inserted */ if (cur->type == EWL_SELECTION_TYPE_INDEX) { - FREE(cur); + ewl_mvc_selection_free(cur); } else ecore_list_append(intersections, cur); @@ -780,7 +781,7 @@ if (ewl_mvc_selection_contained(ptr, range)) { ecore_list_append(mvc->selected, ptr); - FREE(range); + ewl_mvc_selection_free(EWL_SELECTION(range)); range = NULL; break; } @@ -813,7 +814,7 @@ * range */ if (ewl_mvc_selection_contained(range, cur)) { - FREE(cur); + ewl_mvc_selection_free(EWL_SELECTION(cur)); DRETURN(DLEVEL_STABLE); } @@ -828,7 +829,7 @@ range->end.row = MAX(range->end.row, cur->end.row); range->end.column = MAX(range->end.column, cur->end.column); - FREE(cur); + ewl_mvc_selection_free(EWL_SELECTION(cur)); DRETURN(DLEVEL_STABLE); } @@ -888,7 +889,7 @@ cur->end.column); ecore_list_append(list, sel); } - FREE(cur); + ewl_mvc_selection_free(EWL_SELECTION(cur)); DLEAVE_FUNCTION(DLEVEL_STABLE); } @@ -1079,8 +1080,7 @@ row, range->end.column); ecore_list_append(mvc->selected, sel); } - - FREE(range); + ewl_mvc_selection_free(EWL_SELECTION(range)); DLEAVE_FUNCTION(DLEVEL_STABLE); } @@ -1267,7 +1267,6 @@ { if (!sel->highlight) sel->highlight = ecore_list_new(); - ecore_list_append(sel->highlight, h); } @@ -1337,28 +1336,48 @@ static void ewl_mvc_cb_sel_free(void *data) { - Ewl_Selection *sel; - DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("data", data); - sel = data; + ewl_mvc_selection_free(EWL_SELECTION(data)); + data = NULL; + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +static void +ewl_mvc_selection_free(Ewl_Selection *sel) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("sel", sel); + + /* we remove the destroy callback on the highlight as it will try to + * remove itself which causes the selection to get a NULL highlight + * and causes highlights to hang around */ if (sel->highlight) { if (sel->type == EWL_SELECTION_TYPE_INDEX) + { + ewl_callback_del(sel->highlight, EWL_CALLBACK_DESTROY, + ewl_mvc_cb_highlight_destroy); ewl_widget_destroy(sel->highlight); + } else { Ewl_Widget *w; while ((w = ecore_list_first_remove(sel->highlight))) + { + ewl_callback_del(w, EWL_CALLBACK_DESTROY, + ewl_mvc_cb_highlight_destroy); ewl_widget_destroy(w); + } IF_FREE_LIST(sel->highlight); } sel->highlight = NULL; } - FREE(data); + FREE(sel); DLEAVE_FUNCTION(DLEVEL_STABLE); } ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs