1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +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

@ -21,12 +21,14 @@ GraphicsBitmap::GraphicsBitmap(Process& process, const Size& size)
size_t size_in_bytes = size.width() * size.height() * sizeof(RGBA32);
auto vmo = VMObject::create_anonymous(size_in_bytes);
m_client_region = process.allocate_region_with_vmo(LinearAddress(), size_in_bytes, vmo.copyRef(), 0, "GraphicsBitmap (client)", true, true);
m_client_region->set_shared(true);
m_client_region->commit(process);
{
auto& server = WSEventLoop::the().server_process();
InterruptDisabler disabler;
m_server_region = server.allocate_region_with_vmo(LinearAddress(), size_in_bytes, move(vmo), 0, "GraphicsBitmap (server)", true, true);
m_server_region->set_shared(true);
}
m_data = (RGBA32*)m_server_region->linearAddress.asPtr();
}