1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-19 14:31:59 +00:00

Prevent threading problems in TileMap

This commit is contained in:
A Thousand Ships
2024-02-27 15:54:09 +01:00
parent d8cbaa3a8b
commit 36e611fa83
3 changed files with 10 additions and 12 deletions

View File

@@ -68,9 +68,6 @@ void TilesEditorUtils::_thread_func(void *ud) {
}
void TilesEditorUtils::_thread() {
CallQueue queue;
MessageQueue::set_thread_singleton_override(&queue);
pattern_thread_exited.clear();
while (!pattern_thread_exit.is_set()) {
pattern_preview_sem.wait();
@@ -130,8 +127,6 @@ void TilesEditorUtils::_thread() {
// Add the viewport at the last moment to avoid rendering too early.
EditorNode::get_singleton()->call_deferred("add_child", viewport);
MessageQueue::get_singleton()->flush();
RS::get_singleton()->connect(SNAME("frame_pre_draw"), callable_mp(const_cast<TilesEditorUtils *>(this), &TilesEditorUtils::_preview_frame_started), Object::CONNECT_ONE_SHOT);
pattern_preview_done.wait();
@@ -144,11 +139,7 @@ void TilesEditorUtils::_thread() {
viewport->queue_free();
}
}
MessageQueue::get_singleton()->flush();
}
MessageQueue::get_singleton()->flush();
pattern_thread_exited.set();
}