mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Add trivial structure validation to SharedBuffer
If we're sharing buffers, we only want to share trivial structures as anything else could potentially share internal pointers, which most likely is going to cause problems due to different address spaces. Fix the GUI::SystemTheme structure, which was not trivial, which is now caught at compile time. Fixes #3650
This commit is contained in:
@@ -50,7 +50,7 @@ void PageHost::setup_palette()
|
||||
{
|
||||
// FIXME: Get the proper palette from our peer somehow
|
||||
auto buffer = SharedBuffer::create_with_size(sizeof(Gfx::SystemTheme));
|
||||
auto* theme = (Gfx::SystemTheme*)buffer->data();
|
||||
auto* theme = buffer->data<Gfx::SystemTheme>();
|
||||
theme->color[(int)Gfx::ColorRole::Window] = Color::Magenta;
|
||||
theme->color[(int)Gfx::ColorRole::WindowText] = Color::Cyan;
|
||||
m_palette_impl = Gfx::PaletteImpl::create_with_shared_buffer(*buffer);
|
||||
|
||||
Reference in New Issue
Block a user