mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +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
|
@ -621,6 +621,11 @@ bool WSWindowManager::process_ongoing_window_resize(const WSMouseEvent& event, W
|
|||
return true;
|
||||
}
|
||||
|
||||
void WSWindowManager::set_cursor_tracking_button(WSButton* button)
|
||||
{
|
||||
m_cursor_tracking_button = button ? button->make_weak_ptr() : nullptr;
|
||||
}
|
||||
|
||||
void WSWindowManager::process_mouse_event(const WSMouseEvent& event, WSWindow*& event_window)
|
||||
{
|
||||
event_window = nullptr;
|
||||
|
@ -1117,5 +1122,5 @@ const WSCursor& WSWindowManager::active_cursor() const
|
|||
|
||||
void WSWindowManager::set_hovered_button(WSButton* button)
|
||||
{
|
||||
m_hovered_button = button;
|
||||
m_hovered_button = button ? button->make_weak_ptr() : nullptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue