summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2016-06-15 21:35:39 +0900
committerHwankyu Jhun <h.jhun@samsung.com>2016-06-16 08:07:56 +0900
commit5d4ef56db970718cd0181cd9f17dfb601543d660 (patch)
treed1d9972c6ce81808e2400dbf3ec3cf1ea6532252
parent05260c11c6e1e937b0eb0066be09b1c9b5391632 (diff)
downloadapplication-5d4ef56db970718cd0181cd9f17dfb601543d660.tar.gz
application-5d4ef56db970718cd0181cd9f17dfb601543d660.tar.bz2
application-5d4ef56db970718cd0181cd9f17dfb601543d660.zip
Change-Id: Ic6d0759d21cbc47d97fc9f5d6e0f8f7078b42b5f Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r--include/app_internal.h2
-rw-r--r--src/app_main.c15
2 files changed, 15 insertions, 2 deletions
diff --git a/include/app_internal.h b/include/app_internal.h
index d2ccb7b..bdd09fe 100644
--- a/include/app_internal.h
+++ b/include/app_internal.h
@@ -268,7 +268,7 @@ void app_efl_exit(void);
* @param[in] argv The argument vector
* @param[in] callback The set of callback functions to handle application lifecycle events
* @param[in] user_data The user data to be passed to the callback functions
- * @param[in] handle The handle of appcore context
+ * @param[out] handle The appcore_context handle to be newly created on success
*
* @return 0 on success, otherwise a negative error value
* @retval #APP_ERROR_NONE Successful
diff --git a/src/app_main.c b/src/app_main.c
index 2378e8a..ccc1bd8 100644
--- a/src/app_main.c
+++ b/src/app_main.c
@@ -698,7 +698,15 @@ static int __create_ui_app_context(ui_app_lifecycle_callback_s *callback, void *
return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package's app name");
}
- app_context->callback = callback;
+ app_context->callback = (ui_app_lifecycle_callback_s *)malloc(sizeof(ui_app_lifecycle_callback_s));
+ if (app_context->callback == NULL) {
+ free(app_context->app_name);
+ free(app_context->package);
+ free(app_context);
+ return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ }
+ memcpy(app_context->callback, callback, sizeof(ui_app_lifecycle_callback_s));
+
app_context->data = user_data;
*handle = app_context;
@@ -711,6 +719,11 @@ static void __destroy_ui_app_context(struct ui_app_context *handle)
if (handle == NULL)
return;
+ if (handle->callback) {
+ free(handle->callback);
+ handle->callback = NULL;
+ }
+
if (handle->app_name) {
free(handle->app_name);
handle->app_name = NULL;