libweston: Rename weston_surface_destroy() to weston_surface_unref()

Make it obvious that weston_surface has a reference counting happening
and destruction of the weston_surface happens when the last
weston_surface reference has been accounted for.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
dev
Marius Vlad 3 years ago
parent 53a221ccaa
commit 0d8e94af61
  1. 4
      desktop-shell/shell.c
  2. 2
      include/libweston/libweston.h
  3. 8
      libweston/compositor.c
  4. 4
      shell-utils/shell-utils.c
  5. 2
      tests/surface-global-test.c
  6. 2
      tests/surface-test.c

@ -2352,7 +2352,7 @@ desktop_surface_removed(struct weston_desktop_surface *desktop_surface,
fade_out_done, shsurf);
return;
} else {
weston_surface_destroy(surface);
weston_surface_unref(surface);
}
}
@ -4830,7 +4830,7 @@ desktop_shell_destroy_views_on_layer(struct weston_layer *layer)
if (shsurf)
desktop_shell_destroy_surface(shsurf);
else if (is_black_surface_view(view, NULL))
weston_surface_destroy(view->surface);
weston_surface_unref(view->surface);
}
weston_layer_fini(layer);

@ -2030,7 +2030,7 @@ weston_slide_run(struct weston_view *view, float start, float stop,
weston_view_animation_done_func_t done, void *data);
void
weston_surface_destroy(struct weston_surface *surface);
weston_surface_unref(struct weston_surface *surface);
int
weston_output_mode_switch_to_temporary(struct weston_output *output,

@ -2296,7 +2296,7 @@ weston_view_destroy(struct weston_view *view)
}
WL_EXPORT void
weston_surface_destroy(struct weston_surface *surface)
weston_surface_unref(struct weston_surface *surface)
{
struct wl_resource *cb, *next;
struct weston_view *ev, *nv;
@ -2358,7 +2358,7 @@ destroy_surface(struct wl_resource *resource)
/* Set the resource to NULL, since we don't want to leave a
* dangling pointer if the surface was refcounted and survives
* the weston_surface_destroy() call. */
* the weston_surface_unref() call. */
surface->resource = NULL;
if (surface->viewport_resource)
@ -2369,7 +2369,7 @@ destroy_surface(struct wl_resource *resource)
NULL);
}
weston_surface_destroy(surface);
weston_surface_unref(surface);
}
static void
@ -4213,7 +4213,7 @@ compositor_create_surface(struct wl_client *client,
return;
err_res:
weston_surface_destroy(surface);
weston_surface_unref(surface);
err:
wl_resource_post_no_memory(resource);
}

@ -192,7 +192,7 @@ weston_curtain_create(struct weston_compositor *compositor,
err_view:
weston_view_destroy(view);
err_surface:
weston_surface_destroy(surface);
weston_surface_unref(surface);
err_curtain:
free(curtain);
err:
@ -206,7 +206,7 @@ weston_curtain_destroy(struct weston_curtain *curtain)
struct weston_surface *surface = curtain->view->surface;
weston_view_destroy(curtain->view);
weston_surface_destroy(surface);
weston_surface_unref(surface);
weston_buffer_destroy_solid(curtain->buffer_ref);
free(curtain);
}

@ -90,5 +90,5 @@ PLUGIN_TEST(surface_to_from_global)
assert(ix == 0 && iy == 0);
/* Destroys all views too. */
weston_surface_destroy(surface);
weston_surface_unref(surface);
}

@ -70,5 +70,5 @@ PLUGIN_TEST(surface_transform)
assert(x == 200 && y == 340);
/* Destroys all views too. */
weston_surface_destroy(surface);
weston_surface_unref(surface);
}

Loading…
Cancel
Save