1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:27:45 +00:00

WindowServer: Fix visibility of WindowSwitcher constructor

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 separate from the other Servives changes because it
required additional adaption of the code. Note that the old code did
precisely what these changes try to prevent: Create and handle a
ref-counted object with a refcount of zero.
This commit is contained in:
Ben Wiederhake 2021-10-31 23:38:04 +01:00 committed by Andreas Kling
parent 52a1ff4d4b
commit 0e3397aabe
4 changed files with 27 additions and 25 deletions

View file

@ -26,7 +26,6 @@ public:
};
static WindowSwitcher& the();
WindowSwitcher();
virtual ~WindowSwitcher() override;
bool is_visible() const { return m_visible; }
@ -49,6 +48,8 @@ public:
Mode mode() const { return m_mode; }
private:
WindowSwitcher();
int thumbnail_width() const { return 40; }
int thumbnail_height() const { return 40; }
int item_height() const { return 10 + thumbnail_height(); }