mirror of
https://github.com/godotengine/godot
synced 2024-10-14 11:43:32 +00:00
Fix bad uses of mutex causing deadlocks
This commit is contained in:
parent
5002f6de84
commit
98326d88bb
|
@ -109,9 +109,10 @@ void EditorResourcePreview::_thread_func(void *ud) {
|
||||||
|
|
||||||
void EditorResourcePreview::_preview_ready(const String &p_str, const Ref<Texture2D> &p_texture, const Ref<Texture2D> &p_small_texture, ObjectID id, const StringName &p_func, const Variant &p_ud) {
|
void EditorResourcePreview::_preview_ready(const String &p_str, const Ref<Texture2D> &p_texture, const Ref<Texture2D> &p_small_texture, ObjectID id, const StringName &p_func, const Variant &p_ud) {
|
||||||
|
|
||||||
MutexLock lock(preview_mutex);
|
|
||||||
String path = p_str;
|
String path = p_str;
|
||||||
{
|
{
|
||||||
|
MutexLock lock(preview_mutex);
|
||||||
|
|
||||||
uint32_t hash = 0;
|
uint32_t hash = 0;
|
||||||
uint64_t modified_time = 0;
|
uint64_t modified_time = 0;
|
||||||
|
|
||||||
|
@ -364,7 +365,6 @@ void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource> &p
|
||||||
|
|
||||||
cache[path_id].order = order++;
|
cache[path_id].order = order++;
|
||||||
p_receiver->call(p_receiver_func, path_id, cache[path_id].preview, cache[path_id].small_preview, p_userdata);
|
p_receiver->call(p_receiver_func, path_id, cache[path_id].preview, cache[path_id].small_preview, p_userdata);
|
||||||
preview_mutex.unlock();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +391,6 @@ void EditorResourcePreview::queue_resource_preview(const String &p_path, Object
|
||||||
if (cache.has(p_path)) {
|
if (cache.has(p_path)) {
|
||||||
cache[p_path].order = order++;
|
cache[p_path].order = order++;
|
||||||
p_receiver->call(p_receiver_func, p_path, cache[p_path].preview, cache[p_path].small_preview, p_userdata);
|
p_receiver->call(p_receiver_func, p_path, cache[p_path].preview, cache[p_path].small_preview, p_userdata);
|
||||||
preview_mutex.unlock();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,9 +435,10 @@ void EditorResourcePreview::_bind_methods() {
|
||||||
|
|
||||||
void EditorResourcePreview::check_for_invalidation(const String &p_path) {
|
void EditorResourcePreview::check_for_invalidation(const String &p_path) {
|
||||||
|
|
||||||
MutexLock lock(preview_mutex);
|
|
||||||
bool call_invalidated = false;
|
bool call_invalidated = false;
|
||||||
{
|
{
|
||||||
|
MutexLock lock(preview_mutex);
|
||||||
|
|
||||||
if (cache.has(p_path)) {
|
if (cache.has(p_path)) {
|
||||||
|
|
||||||
uint64_t modified_time = FileAccess::get_modified_time(p_path);
|
uint64_t modified_time = FileAccess::get_modified_time(p_path);
|
||||||
|
|
Loading…
Reference in a new issue