File tree Expand file tree Collapse file tree
src/server/frontend_wayland Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -477,19 +477,18 @@ void mf::XdgToplevelStable::set_parent(std::optional<struct wl_resource*> const&
477477 }
478478
479479 // Check that the parent is not a descendant of this toplevel
480- if (auto const this_surface = scene_surface ())
480+ if (scene_surface () && parent_toplevel-> scene_surface ())
481481 {
482- while (auto parent_surface = parent_toplevel->scene_surface ())
482+ auto const this_surface = scene_surface ().value ();
483+ for (auto ancestor = parent_toplevel->scene_surface ().value (); ancestor; ancestor = ancestor->parent ())
483484 {
484- if (parent_surface. value () == this_surface. value () )
485+ if (ancestor == this_surface)
485486 {
486487 throw mw::ProtocolError{
487488 resource,
488489 Error::invalid_parent,
489490 " Parent toplevel must not be a descendant of the child toplevel" };
490491 }
491- auto const grandparent = parent_surface.value ()->parent ();
492- parent_surface = grandparent ? std::optional{grandparent} : std::nullopt ;
493492 }
494493 }
495494
You can’t perform that action at this time.
0 commit comments