mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +00:00
LibGfx: Make Gfx::Bitmap::set_nonvolatile() report allocation failure
Making a bitmap non-volatile after being volatile may fail to allocate physical pages after the kernel stole the old pages in a purge. This is different from the pages being purged, but reallocated. In that case, they are simply replaced with zero-fill-on-demand pages as if they were freshly allocated.
This commit is contained in:
parent
24b5295b30
commit
143443e0b6
23 changed files with 57 additions and 46 deletions
|
@ -410,8 +410,9 @@ void Window::handle_multi_paint_event(MultiPaintEvent& event)
|
|||
m_back_store = create_backing_store(event.window_size());
|
||||
VERIFY(m_back_store);
|
||||
} else if (m_double_buffering_enabled) {
|
||||
bool still_has_pixels = m_back_store->bitmap().set_nonvolatile();
|
||||
if (!still_has_pixels) {
|
||||
bool was_purged = false;
|
||||
bool bitmap_has_memory = m_back_store->bitmap().set_nonvolatile(was_purged);
|
||||
if (!bitmap_has_memory || was_purged) {
|
||||
m_back_store = create_backing_store(event.window_size());
|
||||
VERIFY(m_back_store);
|
||||
created_new_backing_store = true;
|
||||
|
@ -1015,7 +1016,9 @@ void Window::notify_state_changed(Badge<WindowServerConnection>, bool minimized,
|
|||
if (minimized || occluded) {
|
||||
store->bitmap().set_volatile();
|
||||
} else {
|
||||
if (!store->bitmap().set_nonvolatile()) {
|
||||
bool was_purged = false;
|
||||
bool bitmap_has_memory = store->bitmap().set_nonvolatile(was_purged);
|
||||
if (!bitmap_has_memory || was_purged) {
|
||||
store = nullptr;
|
||||
update();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue