diff --git a/src/states_screens/dialogs/addons_loading.cpp b/src/states_screens/dialogs/addons_loading.cpp index 723460fba..3f0f0d8ec 100644 --- a/src/states_screens/dialogs/addons_loading.cpp +++ b/src/states_screens/dialogs/addons_loading.cpp @@ -331,12 +331,15 @@ void AddonsLoading::stopDownload() // (and not uninstalling an installed one): if(m_download_request) { - // In case of a cancel we can't free the memory, since - // network_http will potentially update the request. So in - // order to avoid a memory leak, we let network_http free - // the request. - //m_download_request->setManageMemory(true); + // In case of a cancel we can't free the memory, since the + // request manager thread is potentially working on this request. So + // in order to avoid a memory leak, we let the request manager + // free the data. This is thread safe since freeing the data is done + // when the request manager handles the result queue - and this is + // done by the main thread (i.e. this thread). + m_download_request->setManageMemory(true); m_download_request->cancel(); + m_download_request = NULL; }; } // startDownload