fix lock recursion (on eg windows)

This commit is contained in:
Green Sky 2024-05-26 11:32:06 +02:00
parent 35a0d97170
commit a5ec166794
No known key found for this signature in database

View File

@ -154,10 +154,14 @@ void ChatGui4::setClipboardData(std::vector<std::string> mime_types, std::shared
std::vector<const char*> tmp_mimetype_list;
std::lock_guard lg{_set_clipboard_data_mutex};
for (const auto& mime_type : mime_types) {
tmp_mimetype_list.push_back(mime_type.data());
_set_clipboard_data[mime_type] = data;
{
std::lock_guard lg{_set_clipboard_data_mutex};
for (const auto& mime_type : mime_types) {
tmp_mimetype_list.push_back(mime_type.data());
_set_clipboard_data[mime_type] = data;
}
// release lock, since on some platforms the callback is called immediatly
}
SDL_SetClipboardData(clipboard_callback, nullptr, this, tmp_mimetype_list.data(), tmp_mimetype_list.size());