From 2e6bb987a31179eddcd3f85f405ad9e8c1e2bc24 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sun, 31 Oct 2021 23:21:51 +0100 Subject: [PATCH] AK+WindowServer: Remove did_construct() framework used only once There is also make_ref_counted(), which does not call did_construct(), so the method was not guaranteed to be run. Since there is only a single user, and `WindowServer::Window` is a final class anyway (so there is no need to separate the constructor and post-constructor phases), let's get rid of this concept. (The following commits reduce the opportunities to call make_ref_counted, but still.) --- Userland/Libraries/LibCore/Object.h | 2 -- Userland/Services/WindowServer/Window.cpp | 1 + Userland/Services/WindowServer/Window.h | 5 ----- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Userland/Libraries/LibCore/Object.h b/Userland/Libraries/LibCore/Object.h index 26eaaf8549..c5f83ecd9e 100644 --- a/Userland/Libraries/LibCore/Object.h +++ b/Userland/Libraries/LibCore/Object.h @@ -70,8 +70,6 @@ public: \ static inline NonnullRefPtr construct(Args&&... args) \ { \ auto obj = adopt_ref(*new Klass(forward(args)...)); \ - if constexpr (requires { declval().did_construct(); }) \ - obj->did_construct(); \ return obj; \ } diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp index 6b7394c933..c33acde106 100644 --- a/Userland/Services/WindowServer/Window.cpp +++ b/Userland/Services/WindowServer/Window.cpp @@ -85,6 +85,7 @@ Window::Window(Core::Object& parent, WindowType type) m_minimum_size = s_default_normal_minimum_size; WindowManager::the().add_window(*this); + frame().window_was_constructed({}); } Window::Window(ClientConnection& client, WindowType window_type, int window_id, bool modal, bool minimizable, bool closeable, bool frameless, bool resizable, bool fullscreen, bool accessory, Window* parent_window) diff --git a/Userland/Services/WindowServer/Window.h b/Userland/Services/WindowServer/Window.h index 760ce6ddb8..ea88cff971 100644 --- a/Userland/Services/WindowServer/Window.h +++ b/Userland/Services/WindowServer/Window.h @@ -362,11 +362,6 @@ public: const Vector& screens() const { return m_screens; } Vector& screens() { return m_screens; } - void did_construct() - { - frame().window_was_constructed({}); - } - void set_moving_to_another_stack(bool value) { m_moving_to_another_stack = value; } bool is_moving_to_another_stack() const { return m_moving_to_another_stack; }