Merge pull request #114410 from ej-sanmartin/fix/png-web-import-freeze

Fix importing projects with PNG assets freezes Web Editor
This commit is contained in:
Rémi Verschelde 2026-01-13 22:20:28 +01:00
commit 3d71d7df31
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -3285,7 +3285,12 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
// Emit the resource_reimporting signal for the single file before the actual importation.
emit_signal(SNAME("resources_reimporting"), reloads);
#ifdef THREADS_ENABLED
#ifdef WEB_ENABLED
// On web, busy-wait loops on the main thread block the JavaScript event loop,
// causing the browser tab to appear frozen. Disable threaded imports entirely.
// See GH-112072 for details.
bool use_multiple_threads = false;
#elif defined(THREADS_ENABLED)
bool use_multiple_threads = GLOBAL_GET("editor/import/use_multiple_threads");
#else
bool use_multiple_threads = false;
@ -3750,7 +3755,9 @@ void EditorFileSystem::remove_import_format_support_query(Ref<EditorFileSystemIm
}
EditorFileSystem::EditorFileSystem() {
#ifdef THREADS_ENABLED
#if defined(THREADS_ENABLED) && !defined(WEB_ENABLED)
// On web, threaded scanning blocks the browser's event loop, causing freezes.
// See GH-112072 for details.
use_threads = true;
#endif