e_comp: add post_update add/purge funcs to fix refcounting for e_client accepted/tizen/mobile/20150729.011209 accepted/tizen/tv/20150729.011338 accepted/tizen/wearable/20150729.011416 submit/tizen/20150728.113247
authorGwanglim Lee <gl77.lee@samsung.com>
Tue, 28 Jul 2015 11:31:06 +0000 (20:31 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Tue, 28 Jul 2015 11:31:06 +0000 (20:31 +0900)
Change-Id: Ic97b5865a830568d270a5d2ff048bae2f8eff06b

src/bin/e_client.c
src/bin/e_comp.c
src/bin/e_comp.h
src/bin/e_comp_canvas.c
src/bin/e_comp_wl.c

index 48e8b58fbd5f0d41562cb421dc03911b692e774e..7a69aa70eb590ceb2c427b4a0c9da8f7c38ed4d5 100644 (file)
@@ -447,13 +447,7 @@ _e_client_revert_focus(E_Client *ec)
 static void
 _e_client_free(E_Client *ec)
 {
-   Eina_List *l, *ll;
-   E_Client *ec2;
-   EINA_LIST_FOREACH_SAFE(e_comp->post_updates, l, ll, ec2)
-     {
-        if (ec2 == ec)
-          e_comp->post_updates = eina_list_remove_list(e_comp->post_updates, l);
-     }
+   e_comp_post_update_purge(ec);
 
    e_comp_object_redirected_set(ec->frame, 0);
    e_comp_object_render_update_del(ec->frame);
index 6a6f5072e2a63866fa7c0a2e314e2865983888c1..efe216763c024784e098e0f18a656696ad83612c 100644 (file)
@@ -374,10 +374,7 @@ _e_comp_cb_update(E_Comp *c)
         /* clear update flag */
         e_comp_object_render_update_del(ec->frame);
         if (_e_comp_client_update(ec))
-          {
-             c->post_updates = eina_list_append(c->post_updates, ec);
-             e_object_ref(E_OBJECT(ec));
-          }
+          e_comp_post_update_add(ec);
      }
    _e_comp_fps_update(c);
    if (conf->fps_show)
index d1ac789947719be8522a8bb19fca8224d62505c6..ca49c0e2064168de83464ff5ad9fccb5bee91f25 100644 (file)
@@ -216,5 +216,7 @@ e_comp_util_client_is_fullscreen(const E_Client *ec)
 
 extern EAPI E_Comp *e_comp;
 
+EAPI void e_comp_post_update_add(E_Client *ec);
+EAPI void e_comp_post_update_purge(E_Client *ec);
 #endif
 #endif
index b99c1fb08a72fd2c6ed88c4de1b509986a32997e..8d7ab68310fd69e7554eb79875df26f186a7717e 100644 (file)
@@ -611,3 +611,33 @@ e_comp_canvas_client_layer_map_nearest(int layer)
    LAYER_MAP(E_LAYER_CLIENT_NOTIFICATION_HIGH);
    return E_LAYER_CLIENT_ALERT;
 }
+
+EAPI void
+e_comp_post_update_add(E_Client *ec)
+{
+   Eina_List *l, *ll;
+   E_Client *ec2;
+
+   if (!e_comp) return;
+
+   ec2 = eina_list_data_find(e_comp->post_updates, ec);
+   if (ec2) return;
+
+   e_comp->post_updates = eina_list_append(e_comp->post_updates, ec);
+   e_object_ref(E_OBJECT(ec));
+}
+
+EAPI void
+e_comp_post_update_purge(E_Client *ec)
+{
+   Eina_List *l, *ll;
+   E_Client *ec2;
+
+   if (!e_comp) return;
+
+   EINA_LIST_FOREACH_SAFE(e_comp->post_updates, l, ll, ec2)
+     {
+        if (ec2 == ec)
+          e_comp->post_updates = eina_list_remove_list(e_comp->post_updates, l);
+     }
+}
index 47c70e50902ef75b8411d368ffcfcca68cf2a6b2..fc3ad0c4107d2d13ccfabe1efe4c4a86d4e6a281 100644 (file)
@@ -2202,17 +2202,7 @@ _e_comp_wl_subsurface_commit_from_cache(E_Client *ec)
 
    /* schedule repaint */
    if (e_pixmap_refresh(ec->pixmap))
-     {
-        Eina_List *l, *ll;
-        E_Client *ec2;
-        EINA_LIST_FOREACH_SAFE(e_comp->post_updates, l, ll, ec2)
-          {
-             if (ec2 == ec)
-               e_comp->post_updates = eina_list_remove_list(e_comp->post_updates, l);
-          }
-        e_comp->post_updates = eina_list_append(e_comp->post_updates, ec);
-        e_object_ref(E_OBJECT(ec));
-     }
+     e_comp_post_update_add(ec);
 }
 
 static void
@@ -3411,17 +3401,7 @@ e_comp_wl_surface_commit(E_Client *ec)
 
    /* schedule repaint */
    if (e_pixmap_refresh(ec->pixmap))
-     {
-        Eina_List *l, *ll;
-        E_Client *ec2;
-        EINA_LIST_FOREACH_SAFE(e_comp->post_updates, l, ll, ec2)
-          {
-             if (ec2 == ec)
-               e_comp->post_updates = eina_list_remove_list(e_comp->post_updates, l);
-          }
-        e_comp->post_updates = eina_list_append(e_comp->post_updates, ec);
-        e_object_ref(E_OBJECT(ec));
-     }
+     e_comp_post_update_add(ec);
 
    if (!e_pixmap_usable_get(ec->pixmap))
      {