summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Fritzsch <marcus.fritzsch@xse.de>2014-07-30 17:17:28 +0200
committerNobuhiko Tanibata <NOBUHIKO_TANIBATA@denso.co.jp>2014-08-12 22:15:16 +0900
commitd9feb74b5201eca8c023273a9b6c75ac9e678694 (patch)
treeaa1a37671b05fc51c80d758180a098d43c130fc4
parentf168235494f3de90e285b7e4b521f9306dfb4207 (diff)
downloadwayland-ivi-extension-d9feb74b5201eca8c023273a9b6c75ac9e678694.tar.gz
ilmControl: free resources after use
Signed-off-by: Marcus Fritzsch <marcus.fritzsch@xse.de>
-rw-r--r--ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c54
1 files changed, 42 insertions, 12 deletions
diff --git a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
index a86156f..c28373d 100644
--- a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
+++ b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
@@ -1174,23 +1174,50 @@ registry_control_listener= {
NULL
};
-static struct ilm_control_context ilm_context = {0};
+static struct ilm_control_context ilm_context;
-static void
-destroy_control_resources(void)
+static void destroy_control_resources(void)
{
struct ilm_control_context *ctx = &ilm_context;
- struct screen_context *ctx_scrn;
- struct screen_context *next;
- wl_list_for_each_safe(ctx_scrn, next, &ctx->wl.list_screen, link) {
- if (ctx_scrn->output != NULL) {
- wl_list_remove(&ctx_scrn->link);
- wl_output_destroy(ctx_scrn->output);
- free(ctx_scrn);
- }
- }
if (ctx->wl.controller != NULL) {
+ {
+ struct surface_context *l;
+ struct surface_context *n;
+ wl_list_for_each_safe(l, n, &ctx->wl.list_surface, link) {
+ wl_list_remove(&l->link);
+ wl_list_remove(&l->order.link);
+ ivi_controller_surface_destroy(l->controller, 0);
+ free(l);
+ }
+ }
+
+ {
+ struct layer_context *l;
+ struct layer_context *n;
+ wl_list_for_each_safe(l, n, &ctx->wl.list_layer, link) {
+ wl_list_remove(&l->link);
+ wl_list_remove(&l->order.link);
+ ivi_controller_layer_destroy(l->controller, 0);
+ free(l);
+ }
+ }
+
+ {
+ struct screen_context *ctx_scrn;
+ struct screen_context *next;
+
+ wl_list_for_each_safe(ctx_scrn, next, &ctx->wl.list_screen, link) {
+ if (ctx_scrn->output != NULL) {
+ wl_output_destroy(ctx_scrn->output);
+ }
+
+ wl_list_remove(&ctx_scrn->link);
+ ivi_controller_screen_destroy(ctx_scrn->controller);
+ free(ctx_scrn);
+ }
+ }
+
ivi_controller_destroy(ctx->wl.controller);
ctx->wl.controller = NULL;
}
@@ -1200,6 +1227,9 @@ destroy_control_resources(void)
wl_event_queue_destroy(ctx->wl.queue);
ctx->wl.queue = NULL;
+ wl_registry_destroy(ctx->wl.registry);
+ ctx->wl.registry = NULL;
+
if (0 != pthread_mutex_destroy(&ctx->mutex)) {
fprintf(stderr, "failed to destroy pthread_mutex\n");
}