diff options
author | Marcus Fritzsch <marcus.fritzsch@xse.de> | 2014-08-12 09:37:57 +0200 |
---|---|---|
committer | Nobuhiko Tanibata <NOBUHIKO_TANIBATA@denso.co.jp> | 2014-08-12 22:15:15 +0900 |
commit | bc88070e0ebc4230ab1545ade3dfb835adab430b (patch) | |
tree | 219334c32f4e760ff44aaacb935ab78a90fc5180 | |
parent | e157110a4942041852840a73197902ec8c781ba8 (diff) | |
download | wayland-ivi-extension-bc88070e0ebc4230ab1545ade3dfb835adab430b.tar.gz |
ilmClient: free resources after use
Signed-off-by: Marcus Fritzsch <marcus.fritzsch@xse.de>
-rw-r--r-- | ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c b/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c index 71fc9f1..9f38cad 100644 --- a/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c +++ b/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c @@ -253,29 +253,57 @@ static const struct wl_registry_listener registry_client_listener = { static struct ilm_client_context ilm_context = {0}; static void +destroy_client_resouses(void); + +static void wayland_destroy(void) { struct ilm_client_context *ctx = &ilm_context; - ctx->valid = 0; + if (ctx->valid) + { + destroy_client_resouses(); + ctx->valid = 0; + } } static void destroy_client_resouses(void) { struct ilm_client_context *ctx = &ilm_context; - struct screen_context *ctx_scrn = NULL; - struct screen_context *next = NULL; - wl_list_for_each_safe(ctx_scrn, next, &ctx->list_screen, link) { - if (ctx_scrn->output != NULL) { + + { + struct surface_context *c = NULL; + struct surface_context *n = NULL; + wl_list_for_each_safe(c, n, &ctx->list_surface, link) { + wl_list_remove(&c->link); + ivi_surface_destroy(c->surface); + free(c); + } + } + + { + struct screen_context *ctx_scrn = NULL; + struct screen_context *next = NULL; + wl_list_for_each_safe(ctx_scrn, next, &ctx->list_screen, link) { + if (ctx_scrn->output != NULL) { + wl_output_destroy(ctx_scrn->output); + } + wl_list_remove(&ctx_scrn->link); - wl_output_destroy(ctx_scrn->output); free(ctx_scrn); } } + if (ctx->ivi_application != NULL) { ivi_application_destroy(ctx->ivi_application); ctx->ivi_application = NULL; } + + if (ctx->registry) + { + wl_registry_destroy(ctx->registry); + ctx->registry = NULL; + } } static ilmErrorTypes |