Guarantees the destroy event of a livebox.
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 20 May 2013 11:24:33 +0000 (20:24 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 20 May 2013 11:24:33 +0000 (20:24 +0900)
If there is only one loaded box in the slave,
The slave will be terminated when the last box is deleted.
But the box couldn't get the destroy event, if it is in updating status.

So while terminating the slave,
the process will forcely call the destroy & fainalize function.
Even if it is in updating status.

And then terminate the process.

So now the livebox can gets the destroy event correctly.

Change-Id: Ifd8544fb3be889b696c6ff87b8f60bd577b666fb

icon_src/main.c
include/lb.h
packaging/org.tizen.data-provider-slave.spec
src/critical_log.c
src/fault.c
src/lb.c
src/main.c

index 40b81be..aae3d30 100644 (file)
@@ -78,7 +78,7 @@ const char *livebox_find_pkgname(const char *filename)
 
 int livebox_request_update_by_id(const char *filename)
 {
-       return LB_STATUS_ERROR_NOT_EXISTS;
+       return LB_STATUS_ERROR_NOT_EXIST;
 }
 
 static inline Evas *create_virtual_canvas(int w, int h)
index f9c7052..d2ac15d 100644 (file)
@@ -46,6 +46,7 @@ extern int lb_is_pinned_up(const char *pkgname, const char *id);
 extern void lb_turn_secured_on(void);
 
 extern int lb_is_all_paused(void);
+extern int lb_delete_all_deleteme(void);
 
 /*!
  * Exported API for each liveboxes
index c2ee2d7..1f0e614 100644 (file)
@@ -2,7 +2,7 @@
 
 Name: org.tizen.data-provider-slave
 Summary: Plugin type livebox service provider.
-Version: 0.11.2
+Version: 0.11.3
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index 75d416c..df32238 100644 (file)
@@ -47,6 +47,36 @@ static struct {
 
 
 
+static inline void rotate_log(void)
+{
+       char *filename;
+       int namelen;
+
+       if (s_info.nr_of_lines < MAX_LOG_LINE)
+               return;
+
+       s_info.file_id = (s_info.file_id + 1) % MAX_LOG_FILE;
+
+       namelen = strlen(s_info.filename) + strlen(SLAVE_LOG_PATH) + 20;
+       filename = malloc(namelen);
+       if (filename) {
+               snprintf(filename, namelen, "%s/%d_%s", SLAVE_LOG_PATH, s_info.file_id, s_info.filename);
+
+               if (s_info.fp)
+                       fclose(s_info.fp);
+
+               s_info.fp = fopen(filename, "w+");
+               if (!s_info.fp)
+                       ErrPrint("Failed to open a file: %s\n", filename);
+
+               DbgFree(filename);
+       }
+
+       s_info.nr_of_lines = 0;
+}
+
+
+
 HAPI int critical_log(const char *func, int line, const char *fmt, ...)
 {
        va_list ap;
@@ -67,30 +97,10 @@ HAPI int critical_log(const char *func, int line, const char *fmt, ...)
        ret = vfprintf(s_info.fp, fmt, ap);
        va_end(ap);
 
-       s_info.nr_of_lines++;
-       if (s_info.nr_of_lines == MAX_LOG_LINE) {
-               char *filename;
-               int namelen;
-
-               s_info.file_id = (s_info.file_id + 1) % MAX_LOG_FILE;
+       fflush(s_info.fp);
 
-               namelen = strlen(s_info.filename) + strlen(SLAVE_LOG_PATH) + 20;
-               filename = malloc(namelen);
-               if (filename) {
-                       snprintf(filename, namelen, "%s/%d_%s", SLAVE_LOG_PATH, s_info.file_id, s_info.filename);
-
-                       if (s_info.fp)
-                               fclose(s_info.fp);
-
-                       s_info.fp = fopen(filename, "w+");
-                       if (!s_info.fp)
-                               ErrPrint("Failed to open a file: %s\n", filename);
-
-                       free(filename);
-               }
-
-               s_info.nr_of_lines = 0;
-       }
+       s_info.nr_of_lines++;
+       rotate_log();
        return ret;
 }
 
index 3c712d9..6ee8d5d 100644 (file)
@@ -83,7 +83,7 @@ static void signal_handler(int signum, siginfo_t *info, void *unused)
                        return;
                }
 
-               DbgPrint("ALARM: %d.%d (%d, %d)\n",
+               CRITICAL_LOG("ALARM: %d.%d (%d, %d)\n",
                                res_tv.tv_sec, res_tv.tv_usec, DEFAULT_LIFE_TIMER, DEFAULT_LOAD_TIMER);
        } else if (so_fname) {
                int fd;
@@ -98,12 +98,11 @@ static void signal_handler(int signum, siginfo_t *info, void *unused)
                }
        }
 
-       ErrPrint("=====\n");
-       ErrPrint("SIGNAL> Received from PID[%d]\n", info->si_pid);
-       ErrPrint("SIGNAL> Signal: %d (%d)\n", signum, info->si_signo);
-       ErrPrint("SIGNAL> Error code: %d\n", info->si_code);
-       ErrPrint("SIGNAL> Address: %p\n", info->si_addr);
-       ErrPrint("Package: [%s] Symbol[%s]\n", so_fname, symbol);
+       CRITICAL_LOG("SIGNAL> Received from PID[%d]\n", info->si_pid);
+       CRITICAL_LOG("SIGNAL> Signal: %d (%d)\n", signum, info->si_signo);
+       CRITICAL_LOG("SIGNAL> Error code: %d\n", info->si_code);
+       CRITICAL_LOG("SIGNAL> Address: %p\n", info->si_addr);
+       CRITICAL_LOG("Package: [%s] Symbol[%s]\n", so_fname, symbol);
        free(so_fname);
        free(symbol);
 
index f0d7aaf..b18552d 100644 (file)
--- a/src/lb.c
+++ b/src/lb.c
@@ -855,7 +855,7 @@ HAPI int lb_create(const char *pkgname, const char *id, const char *content_info
                if (!item->timer) {
                        ErrPrint("Failed to add timer (%s - %s, content[%s], cluster[%s], category[%s], abi[%s]\n", pkgname, id, content_info, cluster, category, abi);
                        update_monitor_del(id, item);
-                       so_destroy(inst);
+                       (void)so_destroy(inst);
                        free(item);
                        return LB_STATUS_ERROR_FAULT;
                }
@@ -1308,6 +1308,30 @@ HAPI int lb_update_all(const char *pkgname, const char *cluster, const char *cat
        return LB_STATUS_SUCCESS;
 }
 
+HAPI int lb_delete_all_deleteme(void)
+{
+       Eina_List *l;
+       Eina_List *n;
+       struct item *item;
+       int cnt = 0;
+
+       DbgPrint("Delete all deleteme\n");
+       EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
+               if (!item->deleteme)
+                       continue;
+
+               s_info.item_list = eina_list_remove(s_info.item_list, item);
+
+               update_monitor_del(item->inst->id, item);
+               (void)so_destroy(item->inst);
+               free(item);
+               cnt++;
+       }
+
+       DbgPrint("Deleteme: %d\n", cnt);
+       return LB_STATUS_SUCCESS;
+}
+
 HAPI int lb_system_event_all(int event)
 {
        Eina_List *l;
index 32d4ce1..b48d315 100644 (file)
@@ -235,6 +235,8 @@ static bool app_create(void *data)
        DbgPrint("Current font: %s\n", s_info.font_name);
 
        ret = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &size);
+       DbgPrint("Get fontsize: %d\n", ret);
+
        s_info.font_size = convert_font_size(size);
        DbgPrint("Current size: %d\n", s_info.font_size);
 
@@ -245,8 +247,14 @@ static void app_terminate(void *data)
 {
        int ret;
 
+       ret = lb_delete_all_deleteme();
+       DbgPrint("Delete all deleteme: %d\n", ret);
+
        ret = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE);
+       DbgPrint("unset fontsize: %d\n", ret);
+
        ret = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_FONT_TYPE);
+       DbgPrint("unset font: %d\n", ret);
 
        ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_STIME, time_changed_cb);
        DbgPrint("Remove time changed callback: %d\n", ret);
@@ -256,6 +264,7 @@ static void app_terminate(void *data)
 
        ret = update_monitor_fini();
        DbgPrint("Content update monitor is finalized: %d\n", ret);
+
        ret = fault_fini();
        DbgPrint("Crash recover is finalized: %d\n", ret);