libweston: fold weston_compositor_tear_down() into weston_compositor_destroy()

The only reason why we have both weston_compositor_tear_down() and
weston_compositor_destroy() is that the only we had to destroy
the log context was keeping weston_compositor alive and calling
weston_log_ctx_compositor_destroy().

After commit "weston-log: replace weston_log_ctx_compositor_destroy()
by weston_log_ctx_destroy()", it's not necessary to keep a zombie
weston_compositor just to be able to call
weston_log_ctx_compositor_destroy().

Fold weston_compositor_tear_down() into weston_compositor_destroy(),
as this split is useless now.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
dev
Leandro Ribeiro 5 years ago
parent 4ec38d18b3
commit ca640d5120
  1. 4
      compositor/main.c
  2. 4
      doc/sphinx/toc/libweston/compositor.rst
  3. 2
      include/libweston/libweston.h
  4. 28
      libweston/compositor.c

@ -3375,13 +3375,11 @@ out:
if (protologger)
wl_protocol_logger_destroy(protologger);
weston_compositor_destroy(wet.compositor);
weston_log_scope_destroy(protocol_scope);
protocol_scope = NULL;
weston_compositor_tear_down(wet.compositor);
weston_log_scope_destroy(log_scope);
log_scope = NULL;
weston_compositor_destroy(wet.compositor);
weston_log_ctx_destroy(log_ctx);
weston_log_subscriber_destroy_log(logger);
weston_log_subscriber_destroy_flight_rec(flight_rec);

@ -4,8 +4,8 @@ Compositor
:type:`weston_compositor` represents the core object of the library, which
aggregates all the other objects and maintains their state. You can create it
using :func:`weston_compositor_create`, while for releasing all the resources
associated with it, you should use :func:`weston_compositor_tear_down`,
followed by :func:`weston_compositor_destroy` to destroy it.
associated with it and then destroy it, you should use
:func:`weston_compositor_destroy`.
Compositor API
--------------

@ -1765,8 +1765,6 @@ weston_buffer_from_resource(struct wl_resource *resource);
void
weston_compositor_get_time(struct timespec *time);
void
weston_compositor_tear_down(struct weston_compositor *ec);
void
weston_compositor_destroy(struct weston_compositor *ec);

@ -6529,7 +6529,7 @@ weston_compositor_create_output_with_head(struct weston_compositor *compositor,
* The heads attached to the given output are detached and become unused again.
*
* It is not necessary to explicitly destroy all outputs at compositor exit.
* weston_compositor_tear_down() will automatically destroy any remaining
* weston_compositor_destroy() will automatically destroy any remaining
* outputs.
*
* \ingroup ouput
@ -7633,7 +7633,7 @@ weston_load_module(const char *name, const char *entrypoint)
* the plugin destruction order is not guaranteed: plugins that depend on other
* plugins must be able to be torn down in arbitrary order.
*
* \sa weston_compositor_tear_down, weston_compositor_destroy
* \sa weston_compositor_destroy
*/
WL_EXPORT bool
weston_compositor_add_destroy_listener_once(struct weston_compositor *compositor,
@ -7648,19 +7648,16 @@ weston_compositor_add_destroy_listener_once(struct weston_compositor *compositor
return true;
}
/** Tear down the compositor.
/** Destroys the compositor.
*
* This function cleans up the compositor state. While the compositor state has
* been cleaned do note that **only** weston_compositor_destroy() can be called
* afterwards, in order to destroy the compositor instance.
* This function cleans up the compositor state and then destroys it.
*
* @param compositor The compositor to be tear-down/cleaned.
* @param compositor The compositor to be destroyed.
*
* @ingroup compositor
* @sa weston_compositor_destroy
*/
WL_EXPORT void
weston_compositor_tear_down(struct weston_compositor *compositor)
weston_compositor_destroy(struct weston_compositor *compositor)
{
/* prevent further rendering while shutting down */
compositor->state = WESTON_COMPOSITOR_OFFSCREEN;
@ -7685,20 +7682,7 @@ weston_compositor_tear_down(struct weston_compositor *compositor)
weston_log_scope_destroy(compositor->timeline);
compositor->timeline = NULL;
}
/** Destroys the compositor.
*
* This function destroys the compositor. **Do not** call this before
* calling weston_compositor_tear_down()
*
* @param compositor The compositor to be destroyed.
* @ingroup compositor
* @sa weston_compositor_tear_down()
*/
WL_EXPORT void
weston_compositor_destroy(struct weston_compositor *compositor)
{
free(compositor);
}

Loading…
Cancel
Save