diff --git a/WindowServer/WSClientConnection.cpp b/WindowServer/WSClientConnection.cpp index 9af3a148b6..2fa49bffbf 100644 --- a/WindowServer/WSClientConnection.cpp +++ b/WindowServer/WSClientConnection.cpp @@ -90,7 +90,7 @@ void WSClientConnection::on_message(WSMessage& message) void WSClientConnection::handle_request(WSAPICreateMenubarRequest& request) { int menubar_id = m_next_menubar_id++; - auto menubar = make(menubar_id, *WSMessageLoop::process_from_client_id(request.client_id())); + auto menubar = make(request.client_id(), menubar_id); m_menubars.set(menubar_id, move(menubar)); GUI_ServerMessage response; response.type = GUI_ServerMessage::Type::DidCreateMenubar; diff --git a/WindowServer/WSMenuBar.cpp b/WindowServer/WSMenuBar.cpp index a2d93ae8c0..0f6b389936 100644 --- a/WindowServer/WSMenuBar.cpp +++ b/WindowServer/WSMenuBar.cpp @@ -1,11 +1,10 @@ #include "WSMenuBar.h" #include "WSMenu.h" #include "WSMenuItem.h" -#include -WSMenuBar::WSMenuBar(int menubar_id, Process& process) - : m_menubar_id(menubar_id) - , m_process(process.make_weak_ptr()) +WSMenuBar::WSMenuBar(int client_id, int menubar_id) + : m_client_id(client_id) + , m_menubar_id(menubar_id) { } diff --git a/WindowServer/WSMenuBar.h b/WindowServer/WSMenuBar.h index 285aa8d067..da209e9b9d 100644 --- a/WindowServer/WSMenuBar.h +++ b/WindowServer/WSMenuBar.h @@ -5,15 +5,13 @@ #include #include -class Process; - class WSMenuBar : public Weakable { public: - WSMenuBar(int menubar_id, Process&); + WSMenuBar(int client_id, int menubar_id); ~WSMenuBar(); + int client_id() const { return m_client_id; } int menubar_id() const { return m_menubar_id; } - const Process* process() const { return m_process.ptr(); } void add_menu(WSMenu* menu) { m_menus.append(menu); } template @@ -26,7 +24,7 @@ public: } private: + int m_client_id { 0 }; int m_menubar_id { 0 }; - WeakPtr m_process; Vector m_menus; }; diff --git a/WindowServer/WSWindowManager.h b/WindowServer/WSWindowManager.h index d27a98b18e..91ff9e6967 100644 --- a/WindowServer/WSWindowManager.h +++ b/WindowServer/WSWindowManager.h @@ -65,7 +65,6 @@ public: int api$menu_add_separator(int menu_id); int api$menu_add_item(int menu_id, unsigned identifier, String&& text); - void destroy_all_menus(Process&); private: WSWindowManager();