e_appinfo: Delete E_Appinfo at compositor unbind instead of tzpol, tzlaunch_appinfo... 42/246242/4
authorJunseok, Kim <juns.kim@samsung.com>
Tue, 27 Oct 2020 07:35:38 +0000 (16:35 +0900)
committerJunseok, Kim <juns.kim@samsung.com>
Wed, 28 Oct 2020 10:44:36 +0000 (19:44 +0900)
The tizen_policy and tizen_launch_appinfo unbind can called by client when the client launching.
Since the E_Appinfo is removed at this time and re-created later, the base_output_resolution could not work properly.
For fix this issue, delete E_Appinfo when the compositor unbind callback called.

And added the E_Appinfo_Owner for recognize the E_Appinfo is created by client or server.
The E_Appinfo that created by client, will be destroyed at deregister_pid/appid request callback.
The others that created by server, will be destroyed at compositor unbind.

Change-Id: Id97ab328bc7a8a7ff97455d33f8b72c720b3b56b
Signed-off-by: Junseok, Kim <juns.kim@samsung.com>
src/bin/e_appinfo.c
src/bin/e_appinfo.h
src/bin/e_comp_wl.c
src/bin/e_policy_wl.c

index 4ba6c290d6169048c45c681025b297173bca6f54..928c125e65e06e2afb93ef480c9459e899b20ca5 100644 (file)
@@ -20,6 +20,7 @@ struct _E_Appinfo
    Eina_Bool base_output_available;
    int base_output_width;
    int base_output_height;
+   E_Appinfo_Owner owner;
 };
 
 static void
@@ -65,6 +66,7 @@ e_appinfo_new(void)
 
    eai->pid = -1;
    eai->appid = NULL;
+   eai->owner = E_APPINFO_OWNER_SERVER;
 
    appinfo_list = eina_list_append(appinfo_list, eai);
 
@@ -217,6 +219,22 @@ e_appinfo_base_output_resolution_get(E_Appinfo *eai, int *width, int *height)
    return EINA_TRUE;
 }
 
+EINTERN E_Appinfo_Owner
+e_appinfo_owner_get(E_Appinfo *eai)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(eai, E_APPINFO_OWNER_SERVER);
+
+   return eai->owner;
+}
+
+EINTERN void
+e_appinfo_owner_set(E_Appinfo *eai, E_Appinfo_Owner owner)
+{
+   EINA_SAFETY_ON_NULL_RETURN(eai);
+
+   eai->owner = owner;
+}
+
 E_API E_Appinfo *
 e_appinfo_find_with_pid(pid_t pid)
 {
index 566fc2feb4250b2c707d68f38e6f6580b27cdf1e..2a6d03532ed14bbd70d916dc0d590d44d8521614 100644 (file)
@@ -24,6 +24,12 @@ struct _E_Appinfo_Hook
    unsigned char delete_me : 1;
 };
 
+typedef enum _E_Appinfo_Owner
+{
+   E_APPINFO_OWNER_SERVER,
+   E_APPINFO_OWNER_CLIENT,
+} E_Appinfo_Owner;
+
 EINTERN E_Appinfo           *e_appinfo_new(void);
 EINTERN void                 e_appinfo_del(E_Appinfo *eai);
 EINTERN pid_t                e_appinfo_pid_get(E_Appinfo *epai);
@@ -31,6 +37,8 @@ EINTERN Eina_Bool            e_appinfo_pid_set(E_Appinfo *eai, pid_t pid);
 EINTERN Eina_Bool            e_appinfo_appid_set(E_Appinfo *eai, const char *appid);
 EINTERN void                 e_appinfo_ready_metadata(E_Appinfo *eai, pid_t pid);
 EINTERN Eina_Bool            e_appinfo_base_output_resolution_get(E_Appinfo *eai, int *width, int *height);
+EINTERN E_Appinfo_Owner      e_appinfo_owner_get(E_Appinfo *eai);
+EINTERN void                 e_appinfo_owner_set(E_Appinfo *eai, E_Appinfo_Owner owner);
 
 E_API E_Appinfo             *e_appinfo_find_with_pid(pid_t pid);
 E_API E_Appinfo             *e_appinfo_find_with_appid(const char *appid);
index c9e5a295713e716435ec1ff0cf2596e840bb88b0..50cfd387baa6c38f4f978b69c061c22294cd2277 100644 (file)
@@ -3365,6 +3365,7 @@ _e_comp_wl_pname_print(pid_t pid)
 static void
 _e_comp_wl_compositor_cb_unbind(struct wl_resource *res_comp)
 {
+   E_Appinfo *eai = NULL;
    struct wl_client *client;
    pid_t pid = 0;
    uid_t uid = 0;
@@ -3403,6 +3404,12 @@ _e_comp_wl_compositor_cb_unbind(struct wl_resource *res_comp)
              E_FREE(cinfo);
           }
      }
+
+   eai = e_appinfo_find_with_pid(pid);
+   if (e_appinfo_owner_get(eai) == E_APPINFO_OWNER_SERVER)
+     {
+        e_appinfo_del(eai);
+     }
 }
 
 static void
index 5dbb29593fada854ee6d7f1128cb024881c1b264..f7987277f07b5518dee6f5a4bc84b30dd212f52d 100644 (file)
@@ -3192,6 +3192,7 @@ _tzpol_iface_cb_set_appid(struct wl_client *client, struct wl_resource *res_tzpo
      {
         eai = e_appinfo_new();
         e_appinfo_appid_set(eai, appid);
+        e_appinfo_owner_set(eai, E_APPINFO_OWNER_CLIENT);
      }
    EINA_SAFETY_ON_NULL_RETURN(eai);
 
@@ -3249,13 +3250,6 @@ static void
 _tzpol_cb_unbind(struct wl_resource *res_tzpol)
 {
    E_Policy_Wl_Tzpol *tzpol;
-   E_Appinfo *eai = NULL;
-   pid_t pid = -1;
-
-   wl_client_get_credentials(wl_resource_get_client(res_tzpol), &pid, NULL, NULL);
-   eai = e_appinfo_find_with_pid(pid);
-   if (eai)
-     e_appinfo_del(eai);
 
    tzpol = _e_policy_wl_tzpol_get(res_tzpol);
    EINA_SAFETY_ON_NULL_RETURN(tzpol);
@@ -6507,6 +6501,8 @@ _tzlaunch_appinfo_iface_cb_register_pid(struct wl_client *client, struct wl_reso
         e_appinfo_del(eai);
         return;
      }
+
+   e_appinfo_owner_set(eai, E_APPINFO_OWNER_CLIENT);
 }
 
 static void
@@ -6668,6 +6664,8 @@ _tzlaunch_appinfo_iface_cb_register_appid(struct wl_client *client, struct wl_re
         e_appinfo_del(eai);
         return;
      }
+
+   e_appinfo_owner_set(eai, E_APPINFO_OWNER_CLIENT);
 }
 
 static void
@@ -6808,13 +6806,6 @@ _tzlaunch_appinfo_cb_unbind(struct wl_resource *res_tzlaunch_appinfo)
 {
    E_Policy_Wl_Tzlaunch_Appinfo *tzlaunch_appinfo = NULL;
    Eina_List *l, *ll;
-   E_Appinfo *eai = NULL;
-   pid_t pid = -1;
-
-   wl_client_get_credentials(wl_resource_get_client(res_tzlaunch_appinfo), &pid, NULL, NULL);
-   eai = e_appinfo_find_with_pid(pid);
-   if (eai)
-     e_appinfo_del(eai);
 
    EINA_LIST_FOREACH_SAFE(polwl->tzlaunch_appinfo, l, ll, tzlaunch_appinfo)
      {