From: Piotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics Date: Thu, 15 Sep 2022 10:41:42 +0000 (+0200) Subject: [Download] Fixed download initialization X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3460e34a0d431b1d93c4a2d3e5f00d963fb6dd3f;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Download] Fixed download initialization When many downloads are taking place one after another it was possible that uninitialized memory used for state value has a 5,6,7 status, which caused that web api interpreted it as not valid state change, when the 'DOWNLOADING' state comes. Now this should not occur as the state is initialized before starting a download. Change-Id: I8c0ed0d375e512c1dcc17255f2387df70f3ddcb3 (cherry picked from commit 722a53ccbd76726cb84f65f60c3ba98b0cbb2208) --- diff --git a/src/download/download_instance.cc b/src/download/download_instance.cc index 3a3b6c3..1281047 100644 --- a/src/download/download_instance.cc +++ b/src/download/download_instance.cc @@ -189,7 +189,7 @@ common::PlatformResult DownloadInstance::convertError(int err, const std::string } void DownloadInstance::OnStateChanged(int download_id, download_state_e state, void* user_data) { - ScopeLogger(); + ScopeLogger("State changed for callbackId: %d to: %d", download_id, state); CallbackPtr down_cb_ptr = static_cast(user_data); // Prevent to call finished, cancelled or failed function more than once @@ -628,6 +628,7 @@ void DownloadInstance::DownloadManagerStart(const picojson::value& args, picojso down_cb_ptr->download_id = di_ptr->download_id; down_cb_ptr->instance = this; + down_cb_ptr->state = DOWNLOAD_STATE_NONE; download_callbacks[down_cb_ptr->download_id] = down_cb_ptr;