{
VS_INF("SURFACE %p| Destroy", surface);
- if (surface->source)
- _source_destroy(surface->source);
+ if (surface->role == E_VIDEO_SURFACE_ROLE_VIEWPORT_SOURCE)
+ {
+ if (surface->source)
+ _source_destroy(surface->source);
+ }
- if (surface->subsurface)
- wl_list_remove(&surface->subsurface_destroy.link);
+ if (surface->role == E_VIDEO_SURFACE_ROLE_SUBSURFACE)
+ {
+ if (surface->subsurface)
+ wl_list_remove(&surface->subsurface_destroy.link);
+ }
wl_resource_set_user_data(surface->resource, NULL);
wl_list_remove(&surface->surface_destroy.link);