From 3796d417e00599c263c69ebf1ef4c0dcc52261a7 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sun, 31 Oct 2021 23:38:04 +0100 Subject: Demos+DevTools+Games: Fix visibility of Object-derivative constructors Derivatives of Core::Object should be constructed through ClassName::construct(), to avoid handling ref-counted objects with refcount zero. Fixing the visibility means that misuses like this are more difficult. --- Userland/Demos/Mandelbrot/Mandelbrot.cpp | 2 ++ Userland/DevTools/HackStudio/ClassViewWidget.h | 3 ++- Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.h | 3 +-- Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.h | 2 +- Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.h | 1 + Userland/Games/Minesweeper/Field.h | 3 ++- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Userland/Demos/Mandelbrot/Mandelbrot.cpp b/Userland/Demos/Mandelbrot/Mandelbrot.cpp index 882282972d..91926cf2d2 100644 --- a/Userland/Demos/Mandelbrot/Mandelbrot.cpp +++ b/Userland/Demos/Mandelbrot/Mandelbrot.cpp @@ -218,6 +218,8 @@ class Mandelbrot : public GUI::Frame { void reset(); private: + Mandelbrot() = default; + virtual void paint_event(GUI::PaintEvent&) override; virtual void mousedown_event(GUI::MouseEvent& event) override; virtual void mousemove_event(GUI::MouseEvent& event) override; diff --git a/Userland/DevTools/HackStudio/ClassViewWidget.h b/Userland/DevTools/HackStudio/ClassViewWidget.h index fa25c5f464..1b96ef1427 100644 --- a/Userland/DevTools/HackStudio/ClassViewWidget.h +++ b/Userland/DevTools/HackStudio/ClassViewWidget.h @@ -18,11 +18,12 @@ class ClassViewWidget final : public GUI::Widget { C_OBJECT(ClassViewWidget) public: virtual ~ClassViewWidget() override { } - ClassViewWidget(); void refresh(); private: + ClassViewWidget(); + RefPtr m_class_tree; }; diff --git a/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.h b/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.h index d67d984b5d..d140185f94 100644 --- a/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.h +++ b/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.h @@ -14,10 +14,9 @@ namespace HackStudio { class EvaluateExpressionDialog : public GUI::Dialog { C_OBJECT(EvaluateExpressionDialog); -public: +private: explicit EvaluateExpressionDialog(Window* parent_window); -private: void build(Window* parent_window); void handle_evaluation(const String& expression); void set_output(const StringView& html); diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.h b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.h index 5c88f59ac0..f67e888015 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.h +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.h @@ -14,7 +14,7 @@ namespace LanguageServers::Cpp { class ClientConnection final : public LanguageServers::ClientConnection { C_OBJECT(ClientConnection); -public: +private: ClientConnection(NonnullRefPtr socket, int client_id) : LanguageServers::ClientConnection(move(socket), client_id) { diff --git a/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.h b/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.h index 285f01920e..3eb2adbde6 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.h +++ b/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.h @@ -15,6 +15,7 @@ namespace LanguageServers::Shell { class ClientConnection final : public LanguageServers::ClientConnection { C_OBJECT(ClientConnection); +private: ClientConnection(NonnullRefPtr socket, int client_id) : LanguageServers::ClientConnection(move(socket), client_id) { diff --git a/Userland/Games/Minesweeper/Field.h b/Userland/Games/Minesweeper/Field.h index 015c6ec468..a550714948 100644 --- a/Userland/Games/Minesweeper/Field.h +++ b/Userland/Games/Minesweeper/Field.h @@ -43,7 +43,6 @@ class Field final : public GUI::Frame { friend class SquareLabel; public: - Field(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_button, Function on_size_changed); virtual ~Field() override; size_t rows() const { return m_rows; } @@ -58,6 +57,8 @@ public: void reset(); private: + Field(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_button, Function on_size_changed); + virtual void paint_event(GUI::PaintEvent&) override; void on_square_clicked(Square&); -- cgit v1.2.3