free(frame_callback);
}
+static Eina_Bool
+_e_surface_pending_frame_callback_add(E_Surface *surface, struct wl_resource *resource)
+{
+ E_Frame_Callback *frame_callback;
+
+ frame_callback = E_NEW(E_Frame_Callback, 1);
+ if (!frame_callback)
+ return EINA_FALSE;
+
+ frame_callback->surface = surface;
+
+ frame_callback->destroy.notify = _frame_callback_cb_destroy;
+ wl_resource_add_destroy_listener(resource, &frame_callback->destroy);
+
+ surface->base.pending.frames = eina_list_prepend(surface->base.pending.frames, resource);
+
+ return EINA_TRUE;
+}
+
static void
_e_surface_pending_frame_callback_update(E_Surface *surface)
{
struct ds_surface *ds_surface = surface->ds_surface;
- E_Frame_Callback *frame_callback;
struct wl_resource *resource, *tmp;
wl_resource_for_each_safe(resource, tmp, &ds_surface->current.frame_callback_list)
{
- frame_callback = E_NEW(E_Frame_Callback, 1);
- if (!frame_callback)
- continue;
-
- frame_callback->surface = surface;
-
- frame_callback->destroy.notify = _frame_callback_cb_destroy;
- wl_resource_add_destroy_listener(resource, &frame_callback->destroy);
-
- surface->base.pending.frames = eina_list_prepend(surface->base.pending.frames, resource);
-
- wl_list_remove(wl_resource_get_link(resource));
- wl_list_init(wl_resource_get_link(resource));
+ if (_e_surface_pending_frame_callback_add(surface, resource))
+ {
+ wl_list_remove(wl_resource_get_link(resource));
+ wl_list_init(wl_resource_get_link(resource));
+ }
}
}