Refine toolkit remove logic 87/145287/2 accepted/tizen/3.0/common/20170824.151029 accepted/tizen/3.0/ivi/20170823.221643 accepted/tizen/3.0/mobile/20170823.221600 accepted/tizen/3.0/tv/20170823.221631 submit/tizen_3.0/20170822.050833
authorSemun Lee <semun.lee@samsung.com>
Tue, 22 Aug 2017 03:30:42 +0000 (12:30 +0900)
committerSemun Lee <semun.lee@samsung.com>
Tue, 22 Aug 2017 04:44:44 +0000 (13:44 +0900)
Change-Id: I43d5be327d3f9ebc19ad19a84b7687b5e365265d
Signed-off-by: Semun Lee <semun.lee@samsung.com>
watch-control/src/control.c
widget_viewer_evas/src/widget_viewer_evas.c

index 4a125774a78f0d617d48ff510043108b94beaf59..da3eeb00aae89bc40573db6f25f533a171674bb7 100644 (file)
@@ -414,6 +414,10 @@ API int watch_manager_set_resource_id(int resource_id)
                _E("Fail screen_connector_toolkit_evas_add_by_rid");
                return -1;
        }
+
+       if (__rid_toolkit)
+               screen_connector_toolkit_evas_remove(__rid_toolkit);
+
        __rid_toolkit = handle;
 
        if (__watch_appid) {
@@ -902,7 +906,6 @@ static int __launch_signal_handler(const char *endpoint,
        char *viewer = NULL;
        char *pid_str = NULL;
        screen_connector_toolkit_evas_ops ops;
-       bool exist;
 
        bundle_get_str(envelope, AUL_K_WIDGET_VIEWER, &viewer);
        if (viewer == NULL)
@@ -920,9 +923,7 @@ static int __launch_signal_handler(const char *endpoint,
        _D("cur appid(%s), new appid(%s), pid(%s)",
                        __watch_appid, appid, pid_str);
 
-       exist = screen_connector_toolkit_is_exist(appid,
-                       SCREEN_CONNECTOR_SCREEEN_TYPE_WATCH);
-       if (exist)
+       if (__toolkit)
                screen_connector_toolkit_evas_remove(__toolkit);
 
        ops.added_cb = __screen_connector_toolkit_evas_added_cb;
index 4a845199a93f69af136925701de72c5177ac33c9..1072ad7118cca63b41fb71f7db75d80cd51970dc 100644 (file)
@@ -523,7 +523,6 @@ static int __restart_terminated_widget(const char *widget_id)
        struct widget_info *widget_instance_info;
        int w, h;
        int target_pid = 0;
-       screen_connector_toolkit_evas_h toolkit_h;
 
        g_hash_table_iter_init(&iter, s_info.widget_table);
        while (g_hash_table_iter_next(&iter, &key, &value)) {
@@ -552,10 +551,16 @@ static int __restart_terminated_widget(const char *widget_id)
                        ops.removed_cb = __screen_connector_toolkit_evas_removed_cb;
                        ops.updated_cb = __screen_connector_toolkit_evas_updated_cb;
 
-                       toolkit_h = screen_connector_toolkit_evas_add(&ops, widget_instance_info->instance_id,
-                               SCREEN_CONNECTOR_SCREEEN_TYPE_WIDGET, widget_instance_info);
-                       if (toolkit_h != NULL)
-                               widget_instance_info->toolkit_h = toolkit_h;
+                       if (widget_instance_info->toolkit_h) {
+                               screen_connector_toolkit_evas_remove(widget_instance_info->toolkit_h);
+                               widget_instance_info->toolkit_h = NULL;
+                       }
+
+                       widget_instance_info->toolkit_h = screen_connector_toolkit_evas_add(&ops,
+                                       widget_instance_info->instance_id,
+                                       SCREEN_CONNECTOR_SCREEEN_TYPE_WIDGET,
+                                       widget_instance_info);
+
                        widget_instance_info->pid = widget_instance_launch(widget_instance_info->instance_id, widget_instance_info->content_info, w, h);
                        widget_instance_info->restart = false;
                }
@@ -953,7 +958,6 @@ static void resize_cb(void *data, Evas *e, Evas_Object *layout, void *event_info
        widget_size_type_e size_type;
        screen_connector_toolkit_evas_ops ops;
        struct pending_item *item;
-       screen_connector_toolkit_evas_h toolkit_h;
 
        evas_object_geometry_get(layout, &x, &y, &w, &h);
        if (info->pid == 0) {
@@ -983,10 +987,15 @@ static void resize_cb(void *data, Evas *e, Evas_Object *layout, void *event_info
                ops.added_cb = __screen_connector_toolkit_evas_added_cb;
                ops.removed_cb = __screen_connector_toolkit_evas_removed_cb;
                ops.updated_cb = __screen_connector_toolkit_evas_updated_cb;
-               toolkit_h = screen_connector_toolkit_evas_add(&ops, info->instance_id, SCREEN_CONNECTOR_SCREEEN_TYPE_WIDGET, info);
-               if (toolkit_h != NULL)
-                       info->toolkit_h = toolkit_h;
 
+               if (info->toolkit_h) {
+                       screen_connector_toolkit_evas_remove(info->toolkit_h);
+                       info->toolkit_h = NULL;
+               }
+
+               info->toolkit_h = screen_connector_toolkit_evas_add(&ops, info->instance_id, SCREEN_CONNECTOR_SCREEEN_TYPE_WIDGET, info);
+
+               LOGW("launch a widget instance: %s", info->instance_id);
                info->pid = widget_instance_launch(info->instance_id, info->content_info, w, h);
                if (info->pid < 0) {
                        struct widget_evas_event_info event_info;
@@ -1647,7 +1656,6 @@ EAPI void widget_viewer_evas_activate_faulted_widget(Evas_Object *widget)
 {
        struct widget_info *info;
        screen_connector_toolkit_evas_ops ops;
-       screen_connector_toolkit_evas_h toolkit_h;
 
        if (!is_widget_feature_enabled()) {
                set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
@@ -1692,9 +1700,13 @@ EAPI void widget_viewer_evas_activate_faulted_widget(Evas_Object *widget)
                ops.added_cb = __screen_connector_toolkit_evas_added_cb;
                ops.removed_cb = __screen_connector_toolkit_evas_removed_cb;
                ops.updated_cb = __screen_connector_toolkit_evas_updated_cb;
-               toolkit_h = screen_connector_toolkit_evas_add(&ops, info->instance_id, SCREEN_CONNECTOR_SCREEEN_TYPE_WIDGET, info);
-               if (toolkit_h)
-                       info->toolkit_h = toolkit_h;
+
+               if (info->toolkit_h) {
+                       screen_connector_toolkit_evas_remove(info->toolkit_h);
+                       info->toolkit_h = NULL;
+               }
+
+               info->toolkit_h = screen_connector_toolkit_evas_add(&ops, info->instance_id, SCREEN_CONNECTOR_SCREEEN_TYPE_WIDGET, info);
                info->is_faulted = false;
                info->pid = widget_instance_launch(info->instance_id, info->content_info, w, h);
                if (info->pid < 0) {