Consider appinfo reload
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 10 Mar 2023 04:02:27 +0000 (04:02 +0000)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 10 Mar 2023 07:05:28 +0000 (07:05 +0000)
When the application information is loading again, AMD removes all
app infos. If the application information is reloaded, AMD will be crashed.
To avoid the crash issue, this patch changes the member variable of
the LaunchContext class to the shared_ptr.

Change-Id: If5e231eb570fcfd7980b24c45e2d81271ca6f359
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/launch/launch_context.cc
src/lib/launch/launch_context.hh

index a065b55e82def2142f4eb8ea87ddc15b83bc8751..787ea2b4bf83237d461ae1ac183bf391ff413851 100644 (file)
@@ -33,7 +33,7 @@ void LaunchContext::SetAllowedBackground(bool allowed_background) {
 }
 
 void LaunchContext::SetAppInfo(appinfo_h app_info) {
-  app_info_ = app_info;
+  app_info_ = static_cast<AppInfo*>(app_info)->shared_from_this();
 }
 
 void LaunchContext::SetAppStatus(app_status_h app_status) {
@@ -113,7 +113,7 @@ void LaunchContext::SetReplyInfo(std::shared_ptr<ReplyInfo> reply_info) {
 }
 
 appinfo_h LaunchContext::GetAppInfo() const {
-  return app_info_;
+  return app_info_.get();
 }
 
 app_status_h LaunchContext::GetAppStatus() const {
index 1202895b24169058c3b0b945cdb917396bdd01c9..fe805bd12dff8dd4e72f0f829f496acd5f1a5800 100644 (file)
@@ -30,6 +30,7 @@
 #include "lib/amd_comp_status.h"
 #include "lib/amd_request.h"
 
+#include "lib/app_info/app_info.hh"
 #include "lib/request/pending_item.hh"
 #include "lib/request/reply_info.hh"
 #include "lib/request/request.hh"
@@ -102,7 +103,7 @@ class LaunchContext {
   std::string app_id_;
   bool new_instance_;
   app_status_h app_status_ = nullptr;
-  appinfo_h app_info_ = nullptr;
+  std::shared_ptr<AppInfo> app_info_;
   bool allowed_background_ = false;
   bool background_launch_ = false;
   bool custom_effect_ = false;