From 0ba94fc322de1efbc7542cc6ee1d3feed389ec26 Mon Sep 17 00:00:00 2001 From: raster Date: Mon, 27 Feb 2012 02:37:24 +0000 Subject: [PATCH] tag this allong with the ecore_file_download fix. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@68459 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_file/ecore_file_download.c | 39 +++++++++++++++++++------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/lib/ecore_file/ecore_file_download.c b/src/lib/ecore_file/ecore_file_download.c index 82cd7f3..971493e 100644 --- a/src/lib/ecore_file/ecore_file_download.c +++ b/src/lib/ecore_file/ecore_file_download.c @@ -45,22 +45,27 @@ static Ecore_Event_Handler *_url_complete_handler = NULL; static Ecore_Event_Handler *_url_progress_download = NULL; static Eina_List *_job_list; +static int download_init = 0; + #endif /* BUILD_ECORE_CON */ int ecore_file_download_init(void) { #ifdef BUILD_ECORE_CON - if (!ecore_con_url_init()) - return 0; - + download_init++; + if (download_init > 1) return 1; + if (!ecore_con_init()) return 0; + if (!ecore_con_url_init()) + { + ecore_con_shutdown(); + return 0; + } # ifdef HAVE_CURL - _url_complete_handler = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _ecore_file_download_url_complete_cb, NULL); - _url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL); + _url_complete_handler = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _ecore_file_download_url_complete_cb, NULL); + _url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL); # endif - #endif /* BUILD_ECORE_CON */ - return 1; } @@ -68,15 +73,17 @@ void ecore_file_download_shutdown(void) { #ifdef BUILD_ECORE_CON - if (_url_complete_handler) - ecore_event_handler_del(_url_complete_handler); - if (_url_progress_download) - ecore_event_handler_del(_url_progress_download); - _url_complete_handler = NULL; - _url_progress_download = NULL; - ecore_file_download_abort_all(); - - ecore_con_url_shutdown(); + download_init--; + if (download_init > 0) return; + if (_url_complete_handler) + ecore_event_handler_del(_url_complete_handler); + if (_url_progress_download) + ecore_event_handler_del(_url_progress_download); + _url_complete_handler = NULL; + _url_progress_download = NULL; + ecore_file_download_abort_all(); + ecore_con_url_shutdown(); + ecore_con_shutdown(); #endif /* BUILD_ECORE_CON */ } -- 2.7.4