LibGUI: Avoid unnecessary copies of clipboard metadata

This commit is contained in:
Ben Wiederhake 2023-06-07 11:37:19 +02:00 committed by Andreas Kling
parent 342e1c6eab
commit 592e6c89a5
Notes: sideshowbarker 2024-07-17 04:03:27 +09:00

View File

@ -59,7 +59,7 @@ Clipboard::DataAndType Clipboard::fetch_data_and_type() const
{
auto response = connection().get_clipboard_data();
auto type = response.mime_type();
auto metadata = response.metadata();
auto& metadata = response.metadata();
auto metadata_clone_or_error = metadata.clone();
if (metadata_clone_or_error.is_error())
@ -71,7 +71,7 @@ Clipboard::DataAndType Clipboard::fetch_data_and_type() const
if (data.is_error())
return {};
return { data.release_value(), type, metadata };
return { data.release_value(), type, metadata_clone_or_error.release_value() };
}
RefPtr<Gfx::Bitmap> Clipboard::DataAndType::as_bitmap() const