Enlightenment CVS committal Author : lordchaos Project : e17 Module : proto
Dir : e17/proto/entropy/src/plugins Modified Files: ewl_icon_local_viewer.c Log Message: * Fix an issue where directory load wouldn't be terminated on direcory change, leading to segvs =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/ewl_icon_local_viewer.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- ewl_icon_local_viewer.c 10 Nov 2005 11:38:05 -0000 1.22 +++ ewl_icon_local_viewer.c 13 Nov 2005 08:36:51 -0000 1.23 @@ -25,6 +25,7 @@ Ecore_List* user_data; void* requestor; int count; + int terminate; @@ -46,6 +47,9 @@ Ewl_Widget* file_dialog; Ewl_Widget* file_dialog_parent; + + event_idle_processor* last_processor; + char current_dir[1024]; /* We should handle this at the core. FUTURE API TODO */ }; @@ -637,6 +641,7 @@ int idle_add_icons(void* data) { event_idle_processor* proc = (event_idle_processor*)data; entropy_gui_component_instance* comp = (entropy_gui_component_instance*)proc->requestor; + entropy_icon_viewer* view = ((entropy_icon_viewer*)comp->data); Ecore_List* el = proc->user_data; entropy_generic_file* file; @@ -646,6 +651,11 @@ Ecore_List* added_list = ecore_list_new(); Ecore_List* events; int term=0; + + + if (proc->terminate) { + goto FREE_AND_LEAVE; + } /*data = file list*/ @@ -692,12 +702,20 @@ return 1; } else { ewl_iconbox_scrollpane_recalculate(EWL_ICONBOX( ((entropy_icon_viewer*)comp->data)->iconbox)); + view->last_processor = NULL; + goto FREE_AND_LEAVE; //printf("Terminated process thread..\n"); - ecore_list_destroy(proc->user_data); - entropy_free(proc); return 0; } + + FREE_AND_LEAVE: + ecore_list_destroy(proc->user_data); + entropy_free(proc); + return 0; + + + } void gui_event_callback(entropy_notify_event* eevent, void* requestor, void* ret, void* user_data) { @@ -727,11 +745,27 @@ Ecore_Hash* tmp_icon_hash; entropy_generic_file* list_item; + + /*Keep a reference to our existing hash*/ + tmp_gui_hash = view->gui_hash; + tmp_icon_hash = view->icon_hash; + view->gui_hash = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); + view->icon_hash = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); + + /*Terminate our last load if we are still going...Not the most elegant solution, but there can only be 1 at once*/ + if (view->last_processor) view->last_processor->terminate = 1; + + /*Setup the background processor object*/ //proc->eevent = eevent; proc->requestor = comp; proc->count=0; + proc->terminate = 0; proc->user_data = ecore_list_new(); + view->last_processor = proc; + + + ecore_list_goto_first(ret); while ( (event_file = ecore_list_next(ret))) { @@ -749,17 +783,16 @@ snprintf(view->current_dir, 1024, "%s://%s/%s", request->file->uri_base, request->file->path, request->file->filename); - /*Keep a reference to our existing hash*/ - tmp_gui_hash = view->gui_hash; - tmp_icon_hash = view->icon_hash; - view->gui_hash = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); - view->icon_hash = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); - /*Before we begin, see if our file hash is initialized, if so - we must destroy it first*/ /*TODO*/ gui_object_destroy_and_free(comp, tmp_gui_hash); ecore_hash_destroy(tmp_icon_hash); + + + + + /*Clear the view, if there's anything to nuke*/ ewl_iconbox_clear(EWL_ICONBOX(view->iconbox)); ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs