summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmre Ucan <eucan@de.adit-jv.com>2016-03-17 11:34:32 +0100
committerEugen Friedrich <efriedrich@de.adit-jv.com>2016-03-21 16:46:03 +0100
commitfd24878305bb56a934d304d9e250a46d2546337f (patch)
tree492388894b2ada8c891c351d76bccf46a19006b7
parent96adac823500be172424e94b5094c7d97e68175d (diff)
downloadwayland-ivi-extension-fd24878305bb56a934d304d9e250a46d2546337f.tar.gz
ilmControl: don't free surface context twice
I moved the cleanup code from content listener to destroyed listener, so that we can avoid double free. Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
-rw-r--r--ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c34
1 files changed, 9 insertions, 25 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 92278ac..21708ab 100644
--- a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
+++ b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
@@ -637,6 +637,14 @@ controller_surface_listener_destroyed(void *data,
ILM_NOTIFICATION_CONTENT_REMOVED);
}
+ if (ctx_surf->ctx->notification != NULL) {
+ ilmObjectType surface = ILM_SURFACE;
+ ctx_surf->ctx->notification(surface, ctx_surf->id_surface, ILM_FALSE,
+ ctx_surf->ctx->notification_user_data);
+ }
+
+ ivi_controller_surface_destroy(controller, 1);
+
wl_list_remove(&ctx_surf->order.link);
wl_list_remove(&ctx_surf->link);
free(ctx_surf);
@@ -649,31 +657,7 @@ controller_surface_listener_content(void *data,
{
struct surface_context *ctx_surf = data;
- // if client surface (=content) was removed with ilm_surfaceDestroy()
- // the expected behavior within ILM API mandates a full removal
- // of the surface from the scene. We must remove the controller
- // from scene, too.
- if (IVI_CONTROLLER_SURFACE_CONTENT_STATE_CONTENT_REMOVED == content_state)
- {
- if (ctx_surf->notification != NULL) {
- ctx_surf->notification(ctx_surf->id_surface,
- &ctx_surf->prop,
- ILM_NOTIFICATION_CONTENT_REMOVED);
- }
-
- if (ctx_surf->ctx->notification != NULL) {
- ilmObjectType surface = ILM_SURFACE;
- ctx_surf->ctx->notification(surface, ctx_surf->id_surface, ILM_FALSE,
- ctx_surf->ctx->notification_user_data);
- }
-
- ivi_controller_surface_destroy(controller, 1);
-
- wl_list_remove(&ctx_surf->order.link);
- wl_list_remove(&ctx_surf->link);
- free(ctx_surf);
- }
- else if (IVI_CONTROLLER_SURFACE_CONTENT_STATE_CONTENT_AVAILABLE == content_state)
+ if (IVI_CONTROLLER_SURFACE_CONTENT_STATE_CONTENT_AVAILABLE == content_state)
{
if (ctx_surf->notification != NULL) {
ctx_surf->notification(ctx_surf->id_surface,