diff --git a/include/view.h b/include/view.h index dc8a94c9..e6501a90 100644 --- a/include/view.h +++ b/include/view.h @@ -162,6 +162,7 @@ void view_reload_ssd(struct view *view); void view_impl_map(struct view *view); void view_adjust_size(struct view *view, int *w, int *h); +void view_evacuate_region(struct view *view); void view_on_output_destroy(struct view *view); void view_destroy(struct view *view); diff --git a/src/regions.c b/src/regions.c index 7ca2d9d2..8587055a 100644 --- a/src/regions.c +++ b/src/regions.c @@ -219,12 +219,7 @@ regions_evacuate_output(struct output *output) wl_list_for_each(view, &output->server->views, link) { wl_list_for_each(region, &output->regions, link) { if (view->tiled_region == region) { - if (!view->tiled_region_evacuate) { - view->tiled_region_evacuate = - xstrdup(region->name); - } - /* Prevent carrying around a dangling pointer */ - view->tiled_region = NULL; + view_evacuate_region(view); break; } } diff --git a/src/view.c b/src/view.c index 5966f5f9..8c166bea 100644 --- a/src/view.c +++ b/src/view.c @@ -774,6 +774,17 @@ view_discover_output(struct view *view) view->output = view_output(view); } +void +view_evacuate_region(struct view *view) +{ + assert(view); + assert(view->tiled_region); + if (!view->tiled_region_evacuate) { + view->tiled_region_evacuate = xstrdup(view->tiled_region->name); + } + view->tiled_region = NULL; +} + void view_on_output_destroy(struct view *view) {