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>
This commit is contained in:
committed by
Pekka Paalanen
parent
0c217cb694
commit
6f6c938996
@@ -39,7 +39,6 @@ struct ivi_layout_surface {
|
|||||||
struct ivi_layout *layout;
|
struct ivi_layout *layout;
|
||||||
struct weston_surface *surface;
|
struct weston_surface *surface;
|
||||||
|
|
||||||
struct wl_listener surface_destroy_listener;
|
|
||||||
struct weston_transform surface_rotation;
|
struct weston_transform surface_rotation;
|
||||||
struct weston_transform layer_rotation;
|
struct weston_transform layer_rotation;
|
||||||
struct weston_transform surface_pos;
|
struct weston_transform surface_pos;
|
||||||
@@ -226,4 +225,6 @@ ivi_layout_transition_move_layer_cancel(struct ivi_layout_layer *layer);
|
|||||||
int
|
int
|
||||||
load_controller_modules(struct weston_compositor *compositor, const char *modules,
|
load_controller_modules(struct weston_compositor *compositor, const char *modules,
|
||||||
int *argc, char *argv[]);
|
int *argc, char *argv[]);
|
||||||
|
void
|
||||||
|
ivi_layout_surface_destroy(struct ivi_layout_surface *ivisurf);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+15
-39
@@ -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
|
* Called at destruction of wl_surface/ivi_surface
|
||||||
* This means that this is called from westonsurface_destroy_from_ivisurface.
|
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
ivi_layout_surface_remove(struct ivi_layout_surface *ivisurf)
|
ivi_layout_surface_destroy(struct ivi_layout_surface *ivisurf)
|
||||||
{
|
{
|
||||||
struct ivi_layout *layout = get_instance();
|
struct ivi_layout *layout = get_instance();
|
||||||
|
|
||||||
if (ivisurf == NULL) {
|
if (ivisurf == NULL) {
|
||||||
weston_log("ivi_layout_surface_remove: invalid argument\n");
|
weston_log("%s: invalid argument\n", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wl_list_empty(&ivisurf->pending.link)) {
|
wl_list_remove(&ivisurf->surface_rotation.link);
|
||||||
wl_list_remove(&ivisurf->pending.link);
|
wl_list_remove(&ivisurf->layer_rotation.link);
|
||||||
}
|
wl_list_remove(&ivisurf->surface_pos.link);
|
||||||
if (!wl_list_empty(&ivisurf->order.link)) {
|
wl_list_remove(&ivisurf->layer_pos.link);
|
||||||
wl_list_remove(&ivisurf->order.link);
|
wl_list_remove(&ivisurf->scaling.link);
|
||||||
}
|
|
||||||
if (!wl_list_empty(&ivisurf->link)) {
|
wl_list_remove(&ivisurf->pending.link);
|
||||||
wl_list_remove(&ivisurf->link);
|
wl_list_remove(&ivisurf->order.link);
|
||||||
}
|
wl_list_remove(&ivisurf->link);
|
||||||
remove_ordersurface_from_layer(ivisurf);
|
remove_ordersurface_from_layer(ivisurf);
|
||||||
|
|
||||||
wl_signal_emit(&layout->surface_notification.removed, 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);
|
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;
|
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->layout = layout;
|
||||||
|
|
||||||
ivisurf->surface = wl_surface;
|
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);
|
tmpview = weston_view_create(wl_surface);
|
||||||
if (tmpview == NULL) {
|
if (tmpview == NULL) {
|
||||||
|
|||||||
+18
-8
@@ -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.
|
* The ivi_surface wl_resource destructor.
|
||||||
*
|
*
|
||||||
@@ -154,14 +170,8 @@ shell_handle_surface_destroy(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
assert(ivisurf != NULL);
|
assert(ivisurf != NULL);
|
||||||
|
|
||||||
if (ivisurf->surface!=NULL) {
|
if (ivisurf->layout_surface != NULL)
|
||||||
ivisurf->surface->configure = NULL;
|
layout_surface_cleanup(ivisurf);
|
||||||
ivisurf->surface->configure_private = NULL;
|
|
||||||
ivisurf->surface = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_list_remove(&ivisurf->surface_destroy_listener.link);
|
|
||||||
wl_list_remove(&ivisurf->link);
|
|
||||||
|
|
||||||
if (ivisurf->resource != NULL) {
|
if (ivisurf->resource != NULL) {
|
||||||
wl_resource_set_user_data(ivisurf->resource, NULL);
|
wl_resource_set_user_data(ivisurf->resource, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user