Modified to duplicate bundle when creating JobAction 68/148968/2
authorSomin Kim <somin926.kim@samsung.com>
Mon, 11 Sep 2017 08:28:33 +0000 (17:28 +0900)
committerSomin Kim <somin926.kim@samsung.com>
Mon, 11 Sep 2017 09:36:20 +0000 (18:36 +0900)
Change-Id: I9638528539c808c40cae4fdb929e9095a0893f08
Signed-off-by: Somin Kim <somin926.kim@samsung.com>
include/job_scheduler_internal.h
src/shared/JobAction.cpp

index 7f5f709010ba36e72817a8001d358e4030a3edea..6ea69259408fa1dc2b82bd9ebea73be5756995bf 100644 (file)
@@ -268,6 +268,7 @@ int ctx_sched_job_set_one_time(ctx_sched_job_h job, bool one_time);
 
 /**
  * @brief      Sets the app-control that will be called when the job's execution criteria is satisfied.
+ * @remarks    The @c app_control should be freed using @c bundle_free().
  * @param[in]  job                     Job handle
  * @param[in]  app_control     App-control (bundle-exported)
  * @return     @c 0 on success, otherwise a negative error value
@@ -276,6 +277,7 @@ int ctx_sched_job_set_app_control(ctx_sched_job_h job, bundle* app_control);
 
 /**
  * @brief      Sets the notification that will be called when the job's execution criteria is satisfied.
+ * @remarks    If the @c app_control is not @c NULL, it should be freed using @c bundle_free().
  * @param[in]  job                     Job handle
  * @param[in]  title           Title text
  * @param[in]  content         Content body text
index e6c3978310739a3c9973d4207b49fd4799a65800..dde2d11474c64b26f245574861fd47ac45cc0845 100644 (file)
@@ -170,9 +170,9 @@ void JobDBusCall::toJson(Json::Value& jsonNode) const
        node[KEY_PARAM] = __parameters;
 }
 
-JobAppControl::JobAppControl(bundle* appCtrlBundle) :
-       __appCtrlBundle(appCtrlBundle)
+JobAppControl::JobAppControl(bundle* appCtrlBundle)
 {
+       __appCtrlBundle = bundle_dup(appCtrlBundle);
 }
 
 JobAppControl::JobAppControl(Json::Value& jsonNode)
@@ -206,9 +206,9 @@ JobNotification::JobNotification(
                const std::string& iconPath, bundle* appCtrlBundle) :
        __title(title),
        __content(content),
-       __iconPath(iconPath),
-       __appCtrlBundle(appCtrlBundle)
+       __iconPath(iconPath)
 {
+       __appCtrlBundle = bundle_dup(appCtrlBundle);
 }
 
 JobNotification::JobNotification(Json::Value& jsonNode)