Skip to content

Commit 46d9db5

Browse files
committed
Merge pull request godotengine#96904 from RandomShaper/fix_previewer_deadlock
ResourceLoader: Fix deadlocks caused by the resource changed feature
2 parents 86b40fe + f31867d commit 46d9db5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

core/io/resource_loader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ Ref<Resource> ResourceLoader::_load_complete_inner(LoadToken &p_load_token, Erro
860860
}
861861
}
862862
core_bind::Semaphore done;
863-
MessageQueue::get_main_singleton()->push_callable(callable_mp(&done, &core_bind::Semaphore::post));
863+
MessageQueue::get_main_singleton()->push_callable(callable_mp(&done, &core_bind::Semaphore::post).bind(1));
864864
done.wait();
865865
}
866866
}

editor/editor_resource_preview.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,10 @@ void EditorResourcePreview::stop() {
533533
}
534534

535535
while (!exited.is_set()) {
536+
// Sync pending work.
536537
OS::get_singleton()->delay_usec(10000);
537-
RenderingServer::get_singleton()->sync(); //sync pending stuff, as thread may be blocked on rendering server
538+
RenderingServer::get_singleton()->sync();
539+
MessageQueue::get_singleton()->flush();
538540
}
539541

540542
thread.wait_to_finish();

0 commit comments

Comments
 (0)