From dd13a976afe195e444f2c170d3be28d5107ce156 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Mon, 2 Sep 2024 14:59:06 +0200 Subject: [PATCH] wm: alloc real view IDs locally Don't use client-provided view IDs as IDs for the wrapped nitpicker views. There is no 1:1 relation of IDs and physical views. So if a wm client re-uses an ID, the physical view is expected to stay in tact. If the corresponding view object within the wm is not destroyed, however, its ID remains allocated, which may then conflict the ID of a new view if the ID is reused by the client. This scenario resulted in the following error: Error: Uncaught exception of type 'Genode::Id_space::Conflicting_id' This patch handles the situation by keeping the allocator of physical views (_real_view) decoupled from the client's ID allocator. Issue #5242 --- repos/gems/src/server/wm/gui.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/repos/gems/src/server/wm/gui.h b/repos/gems/src/server/wm/gui.h index 3379749ae4..cd7f101b36 100644 --- a/repos/gems/src/server/wm/gui.h +++ b/repos/gems/src/server/wm/gui.h @@ -141,12 +141,11 @@ class Wm::Gui::View : private Genode::Weak_object, }; View(Real_gui &real_gui, - View_id const &real_view_id, Session_label const &session_label, bool has_alpha) : _session_label(session_label), _real_gui(real_gui), - _real_view(_real_view_ref, _real_gui.view_ids, real_view_id), + _real_view(_real_view_ref, _real_gui.view_ids), _has_alpha(has_alpha) { } @@ -273,12 +272,11 @@ class Wm::Gui::Top_level_view : public View, private List::Eleme public: Top_level_view(Real_gui &real_gui, - View_id view_id, bool has_alpha, Window_registry &window_registry, Input_origin_changed_handler &input_origin_changed_handler) : - View(real_gui, view_id, real_gui.label, has_alpha), + View(real_gui, real_gui.label, has_alpha), _window_registry(window_registry), _input_origin_changed_handler(input_origin_changed_handler), _session_label(real_gui.label) @@ -384,11 +382,10 @@ class Wm::Gui::Child_view : public View, private List::Element public: Child_view(Real_gui &real_gui, - View_id real_gui_id, bool has_alpha, Weak_ptr parent) : - View(real_gui, real_gui_id, real_gui.label, has_alpha), _parent(parent) + View(real_gui, real_gui.label, has_alpha), _parent(parent) { try_to_init_real_view(); } @@ -990,7 +987,7 @@ class Wm::Gui::Session_component : public Rpc_object, _create_view_with_id(_top_level_view_alloc, id, attr, [&] () -> Top_level_view & { view_ptr = new (_top_level_view_alloc) - Top_level_view(_real_gui, id, _has_alpha, + Top_level_view(_real_gui, _has_alpha, _window_registry, *this); return *view_ptr; }); @@ -1013,7 +1010,7 @@ class Wm::Gui::Session_component : public Rpc_object, _create_view_with_id(_child_view_alloc, id, attr, [&] () -> Child_view & { view_ptr = new (_child_view_alloc) - Child_view(_real_gui, id, _has_alpha, parent.weak_ptr()); + Child_view(_real_gui, _has_alpha, parent.weak_ptr()); return *view_ptr; });