barbieri pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=4b771d3e1b3fd17ebab6c410b38ef451248a422a
commit 4b771d3e1b3fd17ebab6c410b38ef451248a422a Author: Gustavo Sverzut Barbieri <barbi...@profusion.mobi> Date: Wed Nov 23 16:23:58 2016 -0200 ecore_file_download: callback completion_cb with status=1. When download is aborted we must call completion_cb using status == 1, this was checked in the test suite. --- src/lib/ecore_file/ecore_file_download.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/lib/ecore_file/ecore_file_download.c b/src/lib/ecore_file/ecore_file_download.c index 406d6ca..bcb8393 100644 --- a/src/lib/ecore_file/ecore_file_download.c +++ b/src/lib/ecore_file/ecore_file_download.c @@ -77,6 +77,7 @@ _ecore_file_download_copier_done(void *data, const Efl_Event *event EINA_UNUSED) { Ecore_File_Download_Completion_Cb cb = job->completion_cb; job->completion_cb = NULL; + ECORE_MAGIC_SET(job, ECORE_MAGIC_NONE); cb((void *)job->data, file, status); } @@ -298,6 +299,8 @@ ecore_file_download_protocol_available(const char *protocol) EAPI void ecore_file_download_abort(Ecore_File_Download_Job *job) { + const char *file; + if (!job) return; if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) @@ -306,8 +309,19 @@ ecore_file_download_abort(Ecore_File_Download_Job *job) return; } - /* don't call it from _ecore_file_download_copier_done() */ - if (job->completion_cb) job->completion_cb = NULL; + efl_file_get(job->output, &file, NULL); + DBG("Aborting download %s -> %s", + efl_net_dialer_address_dial_get(job->input), + file); + + /* abort should have status = 1 */ + if (job->completion_cb) + { + Ecore_File_Download_Completion_Cb cb = job->completion_cb; + job->completion_cb = NULL; + ECORE_MAGIC_SET(job, ECORE_MAGIC_NONE); + cb((void *)job->data, file, 1); + } /* efl_io_closer_close() * -> _ecore_file_download_copier_done() --