@ -287,6 +287,7 @@ weston_surface_create(struct weston_compositor *compositor)
surface - > compositor = compositor ;
surface - > compositor = compositor ;
surface - > alpha = 1.0 ;
surface - > alpha = 1.0 ;
surface - > ref_count = 1 ;
if ( compositor - > renderer - > create_surface ( surface ) < 0 ) {
if ( compositor - > renderer - > create_surface ( surface ) < 0 ) {
free ( surface ) ;
free ( surface ) ;
@ -1003,11 +1004,14 @@ struct weston_frame_callback {
WL_EXPORT void
WL_EXPORT void
weston_surface_destroy ( struct weston_surface * surface )
weston_surface_destroy ( struct weston_surface * surface )
{
{
wl_signal_emit ( & surface - > destroy_signal , & surface - > resource ) ;
struct weston_compositor * compositor = surface - > compositor ;
struct weston_compositor * compositor = surface - > compositor ;
struct weston_frame_callback * cb , * next ;
struct weston_frame_callback * cb , * next ;
if ( - - surface - > ref_count > 0 )
return ;
wl_signal_emit ( & surface - > destroy_signal , & surface - > resource ) ;
assert ( wl_list_empty ( & surface - > geometry . child_list ) ) ;
assert ( wl_list_empty ( & surface - > geometry . child_list ) ) ;
assert ( wl_list_empty ( & surface - > subsurface_list_pending ) ) ;
assert ( wl_list_empty ( & surface - > subsurface_list_pending ) ) ;
assert ( wl_list_empty ( & surface - > subsurface_list ) ) ;
assert ( wl_list_empty ( & surface - > subsurface_list ) ) ;