1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:17:46 +00:00

Libraries: 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.
This commit is contained in:
Ben Wiederhake 2021-10-31 23:38:04 +01:00 committed by Andreas Kling
parent 3796d417e0
commit b3e9a4e603
19 changed files with 62 additions and 50 deletions

View file

@ -81,7 +81,7 @@ private:
class AbstractScrollableWidgetScrollbar final : public Scrollbar {
C_OBJECT(AbstractScrollableWidgetScrollbar);
protected:
private:
explicit AbstractScrollableWidgetScrollbar(AbstractScrollableWidget& owner, Gfx::Orientation orientation)
: Scrollbar(orientation)
, m_owner(owner)
@ -93,7 +93,6 @@ private:
m_owner.handle_wheel_event(event, *this);
}
private:
AbstractScrollableWidget& m_owner;
};
friend class ScrollableWidgetScrollbar;

View file

@ -36,7 +36,7 @@ private:
class VerticalBoxLayout final : public BoxLayout {
C_OBJECT(VerticalBoxLayout);
public:
private:
explicit VerticalBoxLayout()
: BoxLayout(Gfx::Orientation::Vertical)
{
@ -47,7 +47,7 @@ public:
class HorizontalBoxLayout final : public BoxLayout {
C_OBJECT(HorizontalBoxLayout);
public:
private:
explicit HorizontalBoxLayout()
: BoxLayout(Gfx::Orientation::Horizontal)
{

View file

@ -30,9 +30,6 @@ public:
YearOnly
};
Calendar(Core::DateTime date_time = Core::DateTime::now(), Mode mode = Month);
virtual ~Calendar() override;
void set_selected_date(Core::DateTime date_time) { m_selected_date = date_time; }
Core::DateTime selected_date() const { return m_selected_date; }
@ -75,6 +72,9 @@ public:
Function<void()> on_month_click;
private:
Calendar(Core::DateTime date_time = Core::DateTime::now(), Mode mode = Month);
virtual ~Calendar() override;
virtual void resize_event(GUI::ResizeEvent&) override;
virtual void paint_event(GUI::PaintEvent&) override;
virtual void mousemove_event(GUI::MouseEvent&) override;

View file

@ -129,11 +129,6 @@ private:
class ColorSelectOverlay final : public Widget {
C_OBJECT(ColorSelectOverlay)
public:
ColorSelectOverlay()
{
set_override_cursor(Gfx::StandardCursor::Eyedropper);
}
Optional<Color> exec()
{
m_event_loop = make<Core::EventLoop>();
@ -156,6 +151,11 @@ public:
Function<void(Color)> on_color_changed;
private:
ColorSelectOverlay()
{
set_override_cursor(Gfx::StandardCursor::Eyedropper);
}
virtual void mousedown_event(GUI::MouseEvent&) override { m_event_loop->quit(1); }
virtual void mousemove_event(GUI::MouseEvent&) override
{

View file

@ -14,7 +14,6 @@ namespace GUI {
class TextBox : public TextEditor {
C_OBJECT(TextBox)
public:
TextBox();
virtual ~TextBox() override;
Function<void()> on_up_pressed;
@ -23,6 +22,9 @@ public:
void set_history_enabled(bool enabled) { m_history_enabled = enabled; }
void add_current_text_to_history();
protected:
TextBox();
private:
virtual void keydown_event(GUI::KeyEvent&) override;
@ -39,20 +41,21 @@ private:
class PasswordBox : public TextBox {
C_OBJECT(PasswordBox)
public:
private:
PasswordBox();
};
class UrlBox : public TextBox {
C_OBJECT(UrlBox)
public:
UrlBox();
virtual ~UrlBox() override;
void set_focus_transition(bool focus_transition) { m_focus_transition = focus_transition; }
bool is_focus_transition() const { return m_focus_transition; }
private:
UrlBox();
virtual void mousedown_event(GUI::MouseEvent&) override;
virtual void focusout_event(GUI::FocusEvent&) override;

View file

@ -18,14 +18,14 @@ class WindowManagerServerConnection final
, public WindowManagerClientEndpoint {
C_OBJECT(WindowManagerServerConnection)
public:
static WindowManagerServerConnection& the();
private:
WindowManagerServerConnection()
: IPC::ServerConnection<WindowManagerClientEndpoint, WindowManagerServerEndpoint>(*this, "/tmp/portal/wm")
{
}
static WindowManagerServerConnection& the();
private:
virtual void window_removed(i32, i32, i32) override;
virtual void window_state_changed(i32, i32, i32, i32, i32, u32, u32, bool, bool, bool, bool, i32, String const&, Gfx::IntRect const&, Optional<i32> const&) override;
virtual void window_icon_bitmap_changed(i32, i32, i32, Gfx::ShareableBitmap const&) override;