mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-02 22:55:23 +00:00
GWindow: Fix crash when calling set_rect() repeatedly.
We throw away the backing store if the window rect changes size. Since the resizing happens asynchronously at the mercy of the WindowServer, we might end up in set_rect() again before gaining a new backing store. So there are no guarantees that the back/front bitmaps exist here.
This commit is contained in:
@@ -144,9 +144,9 @@ void GWindow::set_rect(const Rect& a_rect)
|
||||
request.window_id = m_window_id;
|
||||
request.window.rect = a_rect;
|
||||
GEventLoop::current().post_message_to_server(request);
|
||||
if (m_back_bitmap->size() != a_rect.size())
|
||||
if (m_back_bitmap && m_back_bitmap->size() != a_rect.size())
|
||||
m_back_bitmap = nullptr;
|
||||
if (m_front_bitmap->size() != a_rect.size())
|
||||
if (m_front_bitmap && m_front_bitmap->size() != a_rect.size())
|
||||
m_front_bitmap = nullptr;
|
||||
if (m_main_widget)
|
||||
m_main_widget->resize(a_rect.size());
|
||||
|
||||
Reference in New Issue
Block a user