mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 01:08:48 +00:00
LibWeb: Don't assume backing store allocation succeeds on OOPWV resize
Backing store allocation can fail if the requested size is too small, or too large. We should not crash when this happens. Fixes #3986.
This commit is contained in:
parent
6e592fb5c3
commit
2d96a07b26
Notes:
sideshowbarker
2024-07-19 01:30:44 +09:00
Author: https://github.com/awesomekling
Commit: 2d96a07b26
1 changed files with 15 additions and 4 deletions
|
@ -84,11 +84,22 @@ void OutOfProcessWebView::resize_event(GUI::ResizeEvent& event)
|
|||
{
|
||||
GUI::ScrollableWidget::resize_event(event);
|
||||
|
||||
m_front_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, available_size())->to_bitmap_backed_by_shared_buffer();
|
||||
m_front_bitmap->shared_buffer()->share_with(client().server_pid());
|
||||
m_front_bitmap = nullptr;
|
||||
m_back_bitmap = nullptr;
|
||||
|
||||
m_back_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, available_size())->to_bitmap_backed_by_shared_buffer();
|
||||
m_back_bitmap->shared_buffer()->share_with(client().server_pid());
|
||||
// FIXME: Don't create a temporary bitmap just to convert it to one backed by a shared buffer.
|
||||
if (auto helper = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, available_size())) {
|
||||
m_front_bitmap = helper->to_bitmap_backed_by_shared_buffer();
|
||||
ASSERT(m_front_bitmap);
|
||||
m_front_bitmap->shared_buffer()->share_with(client().server_pid());
|
||||
}
|
||||
|
||||
// FIXME: Don't create a temporary bitmap just to convert it to one backed by a shared buffer.
|
||||
if (auto helper = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, available_size())) {
|
||||
m_back_bitmap = helper->to_bitmap_backed_by_shared_buffer();
|
||||
ASSERT(m_back_bitmap);
|
||||
m_back_bitmap->shared_buffer()->share_with(client().server_pid());
|
||||
}
|
||||
|
||||
client().post_message(Messages::WebContentServer::SetViewportRect(Gfx::IntRect({ horizontal_scrollbar().value(), vertical_scrollbar().value() }, available_size())));
|
||||
request_repaint();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue