1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:48:11 +00:00

Seal clipboard buffers after copying data into them.

This is just a quick safety mechanism to ensure that nobody alters the
contents of a clipping after it's been set.

Ultimately this will be replaced by a more sophisticated SHM object.
This commit is contained in:
Andreas Kling 2019-03-08 13:33:35 +01:00
parent 6820f9e14f
commit b8581b0069
2 changed files with 2 additions and 0 deletions

View file

@ -44,6 +44,7 @@ void GClipboard::set_data(const String& data)
return;
}
memcpy(shared_buffer->data(), data.characters(), data.length() + 1);
shared_buffer->seal();
request.clipboard.shared_buffer_id = shared_buffer->shared_buffer_id();
request.clipboard.contents_size = data.length();
auto response = GEventLoop::main().sync_request(request, WSAPI_ServerMessage::Type::DidSetClipboardContents);