e_pixmap: check if cp->client is null 65/312165/2
authorSooChan Lim <sc1.lim@samsung.com>
Tue, 4 Jun 2024 23:17:17 +0000 (08:17 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Wed, 5 Jun 2024 01:28:19 +0000 (01:28 +0000)
Check this null validataion at the front of the function.

Change-Id: If29787c21b521f12346a4011ed86e8285dcff6a2

src/bin/core/e_pixmap.c

index 62e5a39..68b69ff 100644 (file)
@@ -584,6 +584,7 @@ e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache)
 EINTERN Eina_Bool
 e_pixmap_image_refresh(E_Pixmap *cp)
 {
+   E_Client *ec;
    E_Comp_Wl_Buffer *buffer = NULL;
    struct wl_shm_buffer *shm_buffer = NULL;
    int bw, bh;
@@ -595,6 +596,9 @@ e_pixmap_image_refresh(E_Pixmap *cp)
         return EINA_FALSE;
      }
 
+   ec = cp->client;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
+
    if (cp->dirty)
      {
         ELOGF("PIXMAP", "cp->dirty is set, cp:%p", NULL, cp);
@@ -607,7 +611,7 @@ e_pixmap_image_refresh(E_Pixmap *cp)
         return EINA_FALSE;
      }
 
-   if ((cp->client) && (e_comp_object_render_update_lock_get(cp->client->frame)))
+   if (e_comp_object_render_update_lock_get(ec->frame))
      {
         ELOGF("PIXMAP", "Render update locked, cp:%p", NULL, cp);
         return EINA_FALSE;
@@ -672,7 +676,7 @@ e_pixmap_image_refresh(E_Pixmap *cp)
          * managed and be pending if previous buffer is not rendered yet. */
         /* set size of image object to new buffer size */
         e_pixmap_size_get(cp, &bw, &bh);
-        e_comp_object_size_update(cp->client->frame, bw, bh);
+        e_comp_object_size_update(ec->frame, bw, bh);
      }
    else if (buffer->type == E_COMP_WL_BUFFER_TYPE_TBM)
      {
@@ -689,7 +693,7 @@ e_pixmap_image_refresh(E_Pixmap *cp)
          * managed and be pending if previous buffer is not rendered yet. */
         /* set size of image object to new buffer size */
         e_pixmap_size_get(cp, &bw, &bh);
-        e_comp_object_size_update(cp->client->frame, bw, bh);
+        e_comp_object_size_update(ec->frame, bw, bh);
 
         /* buffer has no client resources */
         return EINA_TRUE;