diff --git a/ivi-shell/ivi-layout-private.h b/ivi-shell/ivi-layout-private.h index 8b619630..cf2db7d5 100644 --- a/ivi-shell/ivi-layout-private.h +++ b/ivi-shell/ivi-layout-private.h @@ -88,6 +88,8 @@ struct ivi_layout_layer { struct wl_list surface_list; struct wl_list link; } order; + + int32_t ref_count; }; struct ivi_layout { diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c index 079b3e3a..d7108b60 100644 --- a/ivi-shell/ivi-layout.c +++ b/ivi-shell/ivi-layout.c @@ -1820,6 +1820,7 @@ ivi_layout_layer_create_with_dimension(uint32_t id_layer, ivilayer = get_layer(&layout->layer_list, id_layer); if (ivilayer != NULL) { weston_log("id_layer is already created\n"); + ++ivilayer->ref_count; return ivilayer; } @@ -1829,6 +1830,7 @@ ivi_layout_layer_create_with_dimension(uint32_t id_layer, return NULL; } + ivilayer->ref_count = 1; wl_list_init(&ivilayer->link); wl_signal_init(&ivilayer->property_changed); wl_list_init(&ivilayer->screen_list); @@ -1874,6 +1876,9 @@ ivi_layout_layer_remove(struct ivi_layout_layer *ivilayer) return; } + if (--ivilayer->ref_count > 0) + return; + wl_signal_emit(&layout->layer_notification.removed, ivilayer); clear_surface_pending_list(ivilayer);