From f9b5af080e38e5ecd23693ecb5a2155fadcd4706 Mon Sep 17 00:00:00 2001
From: "Piotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics"
Date: Thu, 15 Sep 2022 12:41:42 +0200
Subject: [PATCH] [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)
---
src/download/download_instance.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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;
--
2.7.4