Replaced assert used in wl_egl_window callback functions. 29/243929/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Fri, 11 Sep 2020 07:23:59 +0000 (16:23 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Fri, 11 Sep 2020 07:40:22 +0000 (16:40 +0900)
Change-Id: I25f4aa5263d11656d2f40999a69f539f3c27c27c
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_wayland_egl_thread.c

index d817dd1..27adc14 100755 (executable)
@@ -1332,11 +1332,14 @@ __cb_resize_callback(struct wl_egl_window *wl_egl_window, void *private)
        TPL_ASSERT(wl_egl_window);
 
        struct tizen_private *tizen_private = (struct tizen_private *)private;
+       twe_wl_surf_source *source = (twe_wl_surf_source *)tizen_private->data;
        int cur_w, cur_h, req_w, req_h, format;
 
-       TPL_ASSERT(tizen_private->data);
-
-       twe_wl_surf_source *source = (twe_wl_surf_source *)tizen_private->data;
+       if (!source) {
+               TPL_ERR("Invalid wl_egl_window(%p) tizen_private->data is null.",
+                               wl_egl_window);
+               return;
+       }
 
        format = tbm_surface_queue_get_format(source->tbm_queue);
        cur_w = tbm_surface_queue_get_width(source->tbm_queue);
@@ -1364,7 +1367,11 @@ __cb_rotate_callback(struct wl_egl_window *wl_egl_window, void *private)
        twe_wl_surf_source *source = (twe_wl_surf_source *)tizen_private->data;
        int rotation = tizen_private->rotation;
 
-       TPL_ASSERT(source);
+       if (!source) {
+               TPL_ERR("Invalid wl_egl_window(%p) tizen_private->data is null.",
+                               wl_egl_window);
+               return;
+       }
 
        TPL_LOG_T(BACKEND, "[ROTATE_CB] wl_egl_window(%p) (%d) -> (%d)",
                          wl_egl_window, source->rotation, rotation);
@@ -1384,15 +1391,20 @@ __cb_get_rotation_capability(struct wl_egl_window *wl_egl_window,
 
        int rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_NONE;
        struct tizen_private *tizen_private = (struct tizen_private *)private;
+       twe_wl_surf_source *source = (twe_wl_surf_source *)tizen_private->data;
 
-       if (tizen_private->data) {
-               twe_wl_surf_source *source = (twe_wl_surf_source *)tizen_private->data;
-               if (source->rotation_capability == TPL_TRUE)
-                       rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED;
-               else
-                       rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_UNSUPPORTED;
+       if (!source) {
+               TPL_ERR("Invalid wl_egl_window(%p) tizen_private->data is null.",
+                               wl_egl_window);
+               return rotation_capability;
        }
 
+       if (source->rotation_capability == TPL_TRUE)
+               rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED;
+       else
+               rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_UNSUPPORTED;
+
+
        return rotation_capability;
 }
 
@@ -1404,13 +1416,16 @@ __cb_set_window_serial_callback(struct wl_egl_window *wl_egl_window,
        TPL_ASSERT(wl_egl_window);
 
        struct tizen_private *tizen_private = (struct tizen_private *)private;
+       twe_wl_surf_source *source = (twe_wl_surf_source *)tizen_private->data;
 
-       if (tizen_private->data) {
-               twe_wl_surf_source *source = (twe_wl_surf_source *)tizen_private->data;
-
-               source->set_serial_is_used = TPL_TRUE;
-               source->serial = serial;
+       if (!source) {
+               TPL_ERR("Invalid wl_egl_window(%p) tizen_private->data is null.",
+                               wl_egl_window);
+               return;
        }
+
+       source->set_serial_is_used = TPL_TRUE;
+       source->serial = serial;
 }
 
 static int