mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:37:35 +00:00
WindowServer: Make WSButton a Weakable and stop rawly pointing to it.
We had a crash due to dereferencing a destroyed WSButton after clicking a window close button. Avoid that problem by using WeakPtr.
This commit is contained in:
parent
e74f32ae40
commit
0808d5158c
3 changed files with 11 additions and 5 deletions
|
@ -100,7 +100,7 @@ public:
|
|||
const WSCursor& move_cursor() const { return *m_move_cursor; }
|
||||
|
||||
void set_active_window(WSWindow*);
|
||||
void set_cursor_tracking_button(WSButton* button) { m_cursor_tracking_button = button; }
|
||||
void set_cursor_tracking_button(WSButton*);
|
||||
void set_hovered_button(WSButton*);
|
||||
|
||||
private:
|
||||
|
@ -207,8 +207,8 @@ private:
|
|||
CircularQueue<float, 30> m_cpu_history;
|
||||
|
||||
String m_username;
|
||||
WSButton* m_cursor_tracking_button { nullptr };
|
||||
WSButton* m_hovered_button { nullptr };
|
||||
WeakPtr<WSButton> m_cursor_tracking_button;
|
||||
WeakPtr<WSButton> m_hovered_button;
|
||||
};
|
||||
|
||||
template<typename Callback>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue