summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-07-24 22:49:48 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-25 14:39:25 +0200
commit143443e0b6412cd7f5a702e5b190bea60da733fe (patch)
tree5d1490936ab7a056db804c4ba5ffd22558afa429 /Userland/Libraries/LibWeb
parent24b5295b3038dc0b7a49367476b5b8594268163d (diff)
downloadserenity-143443e0b6412cd7f5a702e5b190bea60da733fe.zip
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.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/Loader/ImageResource.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/Loader/ImageResource.cpp b/Userland/Libraries/LibWeb/Loader/ImageResource.cpp
index 1261559464..508bd62ba6 100644
--- a/Userland/Libraries/LibWeb/Loader/ImageResource.cpp
+++ b/Userland/Libraries/LibWeb/Loader/ImageResource.cpp
@@ -97,8 +97,9 @@ void ImageResource::update_volatility()
if (!frame.bitmap) {
still_has_decoded_image = false;
} else {
- bool still_has_frame = frame.bitmap->set_nonvolatile();
- if (!still_has_frame)
+ bool was_purged = false;
+ bool bitmap_has_memory = frame.bitmap->set_nonvolatile(was_purged);
+ if (!bitmap_has_memory || was_purged)
still_has_decoded_image = false;
}
}