mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 19:27:43 +00:00
FontEditor: Make paste access to Clipboard atomic
This avoids data race issues and saves three out of four synchronous requests to the ClipboardServer.
This commit is contained in:
parent
ff17f6877a
commit
d29f094ffa
1 changed files with 4 additions and 4 deletions
|
@ -84,16 +84,16 @@ void GlyphEditorWidget::copy_glyph()
|
||||||
|
|
||||||
void GlyphEditorWidget::paste_glyph()
|
void GlyphEditorWidget::paste_glyph()
|
||||||
{
|
{
|
||||||
auto mime_type = GUI::Clipboard::the().mime_type();
|
auto [data, mime_type, metadata] = GUI::Clipboard::the().data_and_type();
|
||||||
if (!mime_type.starts_with("glyph/"))
|
if (!mime_type.starts_with("glyph/"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (on_undo_event)
|
if (on_undo_event)
|
||||||
on_undo_event();
|
on_undo_event();
|
||||||
|
|
||||||
auto byte_buffer = GUI::Clipboard::the().data();
|
auto byte_buffer = data.data();
|
||||||
auto buffer_height = GUI::Clipboard::the().data_and_type().metadata.get("height").value().to_int();
|
auto buffer_height = metadata.get("height").value().to_int();
|
||||||
auto buffer_width = GUI::Clipboard::the().data_and_type().metadata.get("width").value().to_int();
|
auto buffer_width = metadata.get("width").value().to_int();
|
||||||
|
|
||||||
u8 bits[buffer_width.value()][buffer_height.value()];
|
u8 bits[buffer_width.value()][buffer_height.value()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue