Implement widget_service_get_instance_count 93/87093/4 accepted/tizen/common/20160908.134549 accepted/tizen/ivi/20160909.001713 accepted/tizen/mobile/20160909.001618 accepted/tizen/tv/20160909.001636 accepted/tizen/wearable/20160909.001652 submit/tizen/20160908.041324
authorHyunho Kang <hhstark.kang@samsung.com>
Tue, 6 Sep 2016 09:05:53 +0000 (18:05 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Thu, 8 Sep 2016 01:19:24 +0000 (10:19 +0900)
Change-Id: Ie927848973f36955635ff120bcf85ffe6ef18f2e
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
src/widget_app.c

index 2128f0b..60d3d08 100755 (executable)
@@ -441,10 +441,10 @@ static int __instance_destroy(widget_class_h handle, const char *id,
        int event = WIDGET_INSTANCE_EVENT_TERMINATE;
        bundle *content_info;
 
-
        if (!wc) {
-               _E("could not find widget obj: %s", id); /* LCOV_EXCL_LINE */
-               return WIDGET_ERROR_INVALID_PARAMETER; /* LCOV_EXCL_LINE */
+               _E("could not find widget obj: %s, clear amd info", id);        /* LCOV_EXCL_LINE */
+               aul_widget_instance_del(handle->classid, id);                   /* LCOV_EXCL_LINE */
+               return WIDGET_ERROR_NONE;                                       /* LCOV_EXCL_LINE */
        }
 
        wc->state = WC_TERMINATED;
@@ -458,13 +458,12 @@ static int __instance_destroy(widget_class_h handle, const char *id,
 
        if (reason == WIDGET_APP_DESTROY_TYPE_PERMANENT) {
                event = WIDGET_INSTANCE_EVENT_DESTROY;
+               aul_widget_instance_del(handle->classid, id);
        } else {
                ret = __send_update_status(handle->classid, id,
                                WIDGET_INSTANCE_EVENT_EXTRA_UPDATED, content_info);
        }
 
-       aul_widget_instance_del(handle->classid, id);
-
        if (content_info)
                bundle_free(content_info);
 
@@ -614,6 +613,7 @@ static void __pause_all(int send_update)
                        __instance_pause(cxt->provider, cxt->id, send_update);
                        break;
                }
+               LOGD("pause %s", cxt->id);
                iter = g_list_next(iter);
        }
 }
@@ -646,16 +646,15 @@ static void __destroy_all(int reason, int send_update)
        GList *iter = g_list_first(contexts);
 
        __pause_all(send_update);
-
        while (iter != NULL) {
                widget_context_s *cxt = (widget_context_s *)iter->data;
-
+               iter = g_list_next(iter);
                switch (cxt->state) {
                case WC_PAUSED:
+                       LOGD("destroy %s", cxt->state, cxt->id);
                        __instance_destroy(cxt->provider, cxt->id, reason, send_update);
                        break;
                }
-               iter = g_list_next(iter);
        }
 }