Watch instance's package information should be updated.
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 1 Jun 2015 11:32:21 +0000 (20:32 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 1 Jun 2015 11:32:21 +0000 (20:32 +0900)
If there is weird changes occurred

Change-Id: I30a7b5372d29d99d642714e20c3c7f887ad48a53

include/instance.h
src/instance.c
src/package.c
src/server.c

index 7ee8750..6c84d34 100644 (file)
@@ -276,5 +276,6 @@ extern int instance_orientation(struct inst_info *inst);
 extern void instance_watch_set_need_to_recover(struct inst_info *inst, int recover);
 extern int instance_watch_need_to_recover(struct inst_info *inst);
 extern int instance_watch_recover_visible_state(struct inst_info *inst);
+extern int instance_watch_change_package_info(struct inst_info *inst, struct pkg_info *info);
 
 /* End of a file */
index 107d921..2bfbd92 100644 (file)
@@ -3924,4 +3924,34 @@ HAPI int instance_watch_need_to_recover(struct inst_info *inst)
        return inst->watch.need_to_recover;
 }
 
+HAPI int instance_watch_change_package_info(struct inst_info *inst, struct pkg_info *info)
+{
+       if (inst->info == info) {
+               DbgPrint("Package information is not touched (%s)\n", package_name(inst->info));
+               return WIDGET_ERROR_NONE;
+       }
+
+       DbgPrint("Instance[%p (%s)], info[%p (%s)]\n",
+                       inst->info, inst->info ? package_name(inst->info) : "unknown",
+                       info, info ? package_name(info) : "unknown");
+       /**
+        * @todo
+        * Handling me, if the instance has package info, it means, this instance is changed its package info...
+        */
+       if (inst->info != info) {
+               if (inst->info) {
+                       ErrPrint("[%s] is already specified for [%s]\n", package_name(inst->info), instance_id(inst));
+                       /**
+                        * @note
+                        * In this case, please handling me, we have to update package info's instance list in this case.
+                        */
+               }
+
+               ErrPrint("Package info is changed to [%s]\n", package_name(info));
+       }
+
+       inst->info = info;
+       return WIDGET_ERROR_NONE;
+}
+
 /* End of a file */
index 1f53b92..13d66d1 100644 (file)
@@ -545,7 +545,7 @@ HAPI struct pkg_info *package_create(const char *pkgid, const char *widget_id)
                ErrPrint("Failed to load DB, fall back to conf file loader\n");
                if (load_conf(pkginfo) < 0) {
                        ErrPrint("Failed to initiate the conf file loader\n");
-                       package_unref(info);
+                       package_unref(pkginfo);
                        return NULL;
                }
        }
index 0643073..43b562b 100644 (file)
@@ -8197,7 +8197,6 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe
                int width, height;
                unsigned int widget_size;
                Eina_List *inst_list;
-               Eina_List *inst_l;
                const char *category;
 
                widget_id = is_valid_slave(pid, abi, pkgname);
@@ -8292,12 +8291,7 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe
                        DbgPrint("widget(%s] does not support size [2x2], [4x4]\n",pkgname);
                }
 
-               if (inst->info != info) {
-                       DbgPrint("Instance[%p (%s)], info[%p (%s)]\n",
-                                       inst->info, inst->info ? package_name(inst->info) : "unknown",
-                                       info, info ? package_name(info) : "unknown");
-                       inst->info = info;
-               }
+               (void)instance_watch_change_package_info(inst, info);
                result = instance_duplicate_packet_create(packet, inst, width, height);
 
                if (instance_watch_need_to_recover(inst)) {