diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2021-11-20 14:37:21 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-11-21 11:49:06 +0000 |
commit | d29f094ffa8fdc49b63fc8cedcf4d0d731fdfdf0 (patch) | |
tree | de93fed47f54111b8b0b995f9784d6f7497110a3 /Userland | |
parent | ff17f6877ac4cf08d417cc6872f742ef242f344b (diff) | |
download | serenity-d29f094ffa8fdc49b63fc8cedcf4d0d731fdfdf0.zip |
FontEditor: Make paste access to Clipboard atomic
This avoids data race issues and saves three out of four synchronous
requests to the ClipboardServer.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/FontEditor/GlyphEditorWidget.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Applications/FontEditor/GlyphEditorWidget.cpp b/Userland/Applications/FontEditor/GlyphEditorWidget.cpp index 1ef56ffcea..63f7311db7 100644 --- a/Userland/Applications/FontEditor/GlyphEditorWidget.cpp +++ b/Userland/Applications/FontEditor/GlyphEditorWidget.cpp @@ -84,16 +84,16 @@ void GlyphEditorWidget::copy_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/")) return; if (on_undo_event) on_undo_event(); - auto byte_buffer = GUI::Clipboard::the().data(); - auto buffer_height = GUI::Clipboard::the().data_and_type().metadata.get("height").value().to_int(); - auto buffer_width = GUI::Clipboard::the().data_and_type().metadata.get("width").value().to_int(); + auto byte_buffer = data.data(); + auto buffer_height = metadata.get("height").value().to_int(); + auto buffer_width = metadata.get("width").value().to_int(); u8 bits[buffer_width.value()][buffer_height.value()]; int i = 0; |