Skip to content

Commit 928059b

Browse files
committed
Fix crash in miral-kiosk and Frame (#4150)
We might calculate the `restore_rect()` before there is a surface asociated with the WindowInfo
1 parent 13f10ce commit 928059b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/miral/window_info.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,9 @@ auto miral::WindowInfo::restore_rect() const -> mir::geometry::Rectangle
304304

305305
// Halfway between current size and min size is reasonable for a maximized/fullscreen window
306306
std::shared_ptr<mir::scene::Surface> const surface{self->window};
307-
auto const min_size_disp = Displacement{as_delta(surface->min_width()), as_delta(surface->min_height())};
307+
auto const min_size_disp = surface ?
308+
Displacement{as_delta(surface->min_width()), as_delta(surface->min_height())} :
309+
Displacement{};
308310
Size const reasonable_size{as_size(
309311
(as_displacement(self->window.size()) - min_size_disp) * 0.5
310312
+ min_size_disp)};

0 commit comments

Comments
 (0)