Initialize presentation_feedbacks list to NULL when created. 66/247966/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Thu, 19 Nov 2020 02:13:17 +0000 (11:13 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Thu, 19 Nov 2020 02:14:47 +0000 (11:14 +0900)
Change-Id: Id969409745c1c6a5bef01c49b80e6c37535e5409
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_wayland_egl_thread.c

index e9630cb..84b6d86 100755 (executable)
@@ -1099,7 +1099,7 @@ _twe_thread_wl_disp_source_destroy(void *source)
                _twe_display_print_err(disp_source, "dispatch_queue_pending");
        }
 
-       if (disp_source->presentation_feedbacks)
+       if (disp_source->presentation && disp_source->presentation_feedbacks)
                __tpl_list_free(disp_source->presentation_feedbacks, (tpl_free_func_t)free);
 
        wl_event_queue_destroy(disp_source->ev_queue);
@@ -1174,6 +1174,8 @@ twe_display_add(twe_thread* thread,
                TPL_DISPLAY_PRESENT_MODE_FIFO;
        _twe_display_wayland_init(source);
 
+       source->presentation_feedbacks = NULL;
+
        if (source->presentation)
                source->presentation_feedbacks = __tpl_list_alloc();
 
@@ -2399,8 +2401,9 @@ __cb_presentation_feedback_discarded(void *data,
        if (presentation_feedback)
                wp_presentation_feedback_destroy(presentation_feedback);
 
-       __tpl_list_remove_data(disp_source->presentation_feedbacks, feedback_info,
-                                                  TPL_FIRST, (tpl_free_func_t)free);
+       if (disp_source->presentation_feedbacks)
+               __tpl_list_remove_data(disp_source->presentation_feedbacks, feedback_info,
+                                                          TPL_FIRST, (tpl_free_func_t)free);
 
        g_mutex_unlock(&surf_source->pst_mutex);
 }
@@ -2442,7 +2445,9 @@ _twe_thread_wl_surface_commit(twe_wl_surf_source *surf_source,
                        feedback_info->surf_source = surf_source;
                        wp_presentation_feedback_add_listener(feedback_info->feedback,
                                                                                                  &feedback_listener, feedback_info);
-                       __tpl_list_push_back(disp_source->presentation_feedbacks, (void *)feedback_info);
+                       if (disp_source->presentation_feedbacks)
+                               __tpl_list_push_back(disp_source->presentation_feedbacks,
+                                                                        (void *)feedback_info);
                }
        }
        g_mutex_unlock(&surf_source->pst_mutex);