1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

Mark the two Regions used GraphicsBitmaps as explicitly shared.

This fixes a goofy problem where forking a GUI process would cowify the
GraphicsBitmap for everyone making a hue confusing mess.
This commit is contained in:
Andreas Kling 2019-01-21 05:18:28 +01:00
parent d1af5c97ca
commit 76a2881793
3 changed files with 11 additions and 1 deletions

View file

@ -563,11 +563,16 @@ RetainPtr<Region> Region::clone()
{
InterruptDisabler disabler;
if (is_readable && !is_writable) {
if (m_shared || (is_readable && !is_writable)) {
// Create a new region backed by the same VMObject.
return adopt(*new Region(linearAddress, size, m_vmo.copyRef(), m_offset_in_vmo, String(name), is_readable, is_writable));
}
dbgprintf("%s<%u> Region::clone(): cowing %s (L%x)\n",
current->name().characters(),
current->pid(),
name.characters(),
linearAddress.get());
// Set up a COW region. The parent (this) region becomes COW as well!
for (size_t i = 0; i < page_count(); ++i)
cow_map.set(i, true);