ivi-shell: make ivi_layout_surface destruction explicit

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Nobuhiko Tanibata 10 years ago committed by Pekka Paalanen
parent 0c217cb694
commit 6f6c938996
  1. 3
      ivi-shell/ivi-layout-private.h
  2. 48
      ivi-shell/ivi-layout.c
  3. 26
      ivi-shell/ivi-shell.c

@ -39,7 +39,6 @@ struct ivi_layout_surface {
struct ivi_layout *layout;
struct weston_surface *surface;
struct wl_listener surface_destroy_listener;
struct weston_transform surface_rotation;
struct weston_transform layer_rotation;
struct weston_transform surface_pos;
@ -226,4 +225,6 @@ ivi_layout_transition_move_layer_cancel(struct ivi_layout_layer *layer);
int
load_controller_modules(struct weston_compositor *compositor, const char *modules,
int *argc, char *argv[]);
void
ivi_layout_surface_destroy(struct ivi_layout_surface *ivisurf);
#endif

@ -320,28 +320,27 @@ ivi_layout_surface_remove_notification(struct ivi_layout_surface *ivisurf)
}
/**
* this shall not be called from controller because this is triggered by ivi_surface.destroy
* This means that this is called from westonsurface_destroy_from_ivisurface.
* Called at destruction of wl_surface/ivi_surface
*/
static void
ivi_layout_surface_remove(struct ivi_layout_surface *ivisurf)
void
ivi_layout_surface_destroy(struct ivi_layout_surface *ivisurf)
{
struct ivi_layout *layout = get_instance();
if (ivisurf == NULL) {
weston_log("ivi_layout_surface_remove: invalid argument\n");
weston_log("%s: invalid argument\n", __func__);
return;
}
if (!wl_list_empty(&ivisurf->pending.link)) {
wl_list_remove(&ivisurf->surface_rotation.link);
wl_list_remove(&ivisurf->layer_rotation.link);
wl_list_remove(&ivisurf->surface_pos.link);
wl_list_remove(&ivisurf->layer_pos.link);
wl_list_remove(&ivisurf->scaling.link);
wl_list_remove(&ivisurf->pending.link);
}
if (!wl_list_empty(&ivisurf->order.link)) {
wl_list_remove(&ivisurf->order.link);
}
if (!wl_list_empty(&ivisurf->link)) {
wl_list_remove(&ivisurf->link);
}
remove_ordersurface_from_layer(ivisurf);
wl_signal_emit(&layout->surface_notification.removed, ivisurf);
@ -350,28 +349,9 @@ ivi_layout_surface_remove(struct ivi_layout_surface *ivisurf)
ivi_layout_surface_remove_notification(ivisurf);
free(ivisurf);
}
/**
* Called at destruction of ivi_surface
*/
static void
westonsurface_destroy_from_ivisurface(struct wl_listener *listener, void *data)
{
struct ivi_layout_surface *ivisurf = NULL;
ivisurf = container_of(listener, struct ivi_layout_surface,
surface_destroy_listener);
wl_list_remove(&ivisurf->surface_rotation.link);
wl_list_remove(&ivisurf->layer_rotation.link);
wl_list_remove(&ivisurf->surface_pos.link);
wl_list_remove(&ivisurf->layer_pos.link);
wl_list_remove(&ivisurf->scaling.link);
ivisurf->surface = NULL;
ivi_layout_surface_remove(ivisurf);
free(ivisurf);
}
/**
@ -2812,10 +2792,6 @@ ivi_layout_surface_create(struct weston_surface *wl_surface,
ivisurf->layout = layout;
ivisurf->surface = wl_surface;
ivisurf->surface_destroy_listener.notify =
westonsurface_destroy_from_ivisurface;
wl_resource_add_destroy_listener(wl_surface->resource,
&ivisurf->surface_destroy_listener);
tmpview = weston_view_create(wl_surface);
if (tmpview == NULL) {

@ -130,6 +130,22 @@ ivi_shell_surface_configure(struct weston_surface *surface,
}
}
static void
layout_surface_cleanup(struct ivi_shell_surface *ivisurf)
{
assert(ivisurf->layout_surface != NULL);
ivi_layout_surface_destroy(ivisurf->layout_surface);
ivisurf->layout_surface = NULL;
ivisurf->surface->configure = NULL;
ivisurf->surface->configure_private = NULL;
ivisurf->surface = NULL;
// destroy weston_surface destroy signal.
wl_list_remove(&ivisurf->surface_destroy_listener.link);
}
/*
* The ivi_surface wl_resource destructor.
*
@ -154,14 +170,8 @@ shell_handle_surface_destroy(struct wl_listener *listener, void *data)
assert(ivisurf != NULL);
if (ivisurf->surface!=NULL) {
ivisurf->surface->configure = NULL;
ivisurf->surface->configure_private = NULL;
ivisurf->surface = NULL;
}
wl_list_remove(&ivisurf->surface_destroy_listener.link);
wl_list_remove(&ivisurf->link);
if (ivisurf->layout_surface != NULL)
layout_surface_cleanup(ivisurf);
if (ivisurf->resource != NULL) {
wl_resource_set_user_data(ivisurf->resource, NULL);

Loading…
Cancel
Save