mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:12:44 +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
					
				
					 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(); | ||||
|     // 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
	
	 Andreas Kling
						Andreas Kling