Do not check period when instance create fail 63/150863/3
authorHyunho Kang <hhstark.kang@samsung.com>
Wed, 16 Aug 2017 04:44:32 +0000 (13:44 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Thu, 21 Sep 2017 08:47:30 +0000 (17:47 +0900)
Change-Id: I6870e0ff6bd93f92f100ad8a0baf6f9d84285dce
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
src/base/widget_base.c

index 34c94f5..92c8123 100644 (file)
@@ -294,9 +294,6 @@ static void __control_create(const char *class_id, const char *id, bundle *b)
 {
        widget_base_instance_data *data;
        char *content = NULL;
-       double *period = NULL;
-       size_t size;
-       int ret;
 
        data = (widget_base_instance_data *)
                        calloc(1, sizeof(widget_base_instance_data));
@@ -307,12 +304,6 @@ static void __control_create(const char *class_id, const char *id, bundle *b)
 
        data->id = strdup(id);
        data->args = b;
-       ret = bundle_get_byte(b, WIDGET_K_PERIOD, (void **)&period, &size);
-       if (ret == BUNDLE_ERROR_NONE) {
-               data->period = *period;
-               data->periodic_timer = g_timeout_add_seconds(data->period,
-                               __timeout_cb, data);
-       }
 
        /* call stub create */
        appcore_multiwindow_base_instance_run(class_id, id, data);
@@ -1330,6 +1321,8 @@ static void __multiwindow_instance_create(
        int h = 0;
        int ret = -1;
        widget_base_class *cls;
+       double *period = NULL;
+       size_t size;
 
        appcore_multiwindow_base_class_on_create(instance_h);
        instance_data = appcore_multiwindow_base_instance_get_extra(instance_h);
@@ -1375,13 +1368,26 @@ static void __multiwindow_instance_create(
                LOGW("Create callback returns error(%d)", ret);
                ret = __send_update_status(class_id, id,
                                WIDGET_INSTANCE_EVENT_CREATE_ABORTED, NULL);
+               if (ret < 0)
+                       LOGE("Fail to send abort status (%d) ", ret);
                __instance_drop(instance_h);
        } else {
                LOGD("%s is created", id);
                ret = __send_update_status(class_id, id,
                        WIDGET_INSTANCE_EVENT_CREATE, NULL);
+               if (ret < 0)
+                       LOGE("Fail to send create status (%d) ", ret);
 
                aul_widget_instance_add(class_id, id);
+
+               ret = bundle_get_byte(b, WIDGET_K_PERIOD, (void **)&period,
+                               &size);
+               if (ret == BUNDLE_ERROR_NONE) {
+                       instance_data->period = *period;
+                       instance_data->periodic_timer = g_timeout_add_seconds(
+                                       instance_data->period,
+                                       __timeout_cb, instance_data);
+               }
        }
 
        if (content_info)