Giter Club home page Giter Club logo

Comments (3)

bruvzg avatar bruvzg commented on June 28, 2024 2

A quick fix for the crash (switches to background progress if called for non-main thread), but it's probably something wrong with the FS update logic as well:

 
 struct EditorProgress {
 	String task;
-	bool step(const String &p_state, int p_step = -1, bool p_force_refresh = true) { return EditorNode::progress_task_step(task, p_state, p_step, p_force_refresh); }
+	bool step(const String &p_state, int p_step = -1, bool p_force_refresh = true) { 
+		if (Thread::is_main_thread()) {
+			return EditorNode::progress_task_step(task, p_state, p_step, p_force_refresh);
+		} else {
+			EditorNode::progress_task_step_bg(task, p_step);
+			return false;
+		}
+	}
 	EditorProgress(const String &p_task, const String &p_label, int p_amount, bool p_can_cancel = false) {
-		EditorNode::progress_add_task(p_task, p_label, p_amount, p_can_cancel);
+		if (Thread::is_main_thread()) {
+			EditorNode::progress_add_task(p_task, p_label, p_amount, p_can_cancel);
+		} else {
+			EditorNode::progress_add_task_bg(p_task, p_label, p_amount);
+		}
 		task = p_task;
 	}
-	~EditorProgress() { EditorNode::progress_end_task(task); }
+	~EditorProgress() {
+		if (Thread::is_main_thread()) {
+			EditorNode::progress_end_task(task);
+		} else {
+			EditorNode::progress_end_task_bg(task);
+		}
+	}
 };
 
 class EditorPluginList : public Object {

from godot.

Hilderin avatar Hilderin commented on June 28, 2024 1

I looked into it. Effectively, the replacement of the return by a continue caused the problem.
Importing a ttf call update_files but it does not exists in the file system. With the return, _update_pending_script_classes and _update_pending_scene_groups were never called.
image

I'll create a PR to fix that soon.

I also think that the suggestion from @bruvzg could be a really nice fail safe.

from godot.

bruvzg avatar bruvzg commented on June 28, 2024

Crash log from macOS, seems like process dialog is popped up from the thread (which definitely should not happen):

Thread 0::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x18fc1d7e8 __semwait_signal + 8
1   libsystem_c.dylib             	       0x18fafe568 nanosleep + 220
2   Godot                         	       0x101b9c544 OS_Unix::delay_usec(unsigned int) const + 64 (os_unix.cpp:289)
3   Godot                         	       0x101f882b8 EditorFileSystem::reimport_files(Vector<String> const&) + 3560 (editor_file_system.cpp:2430)
4   Godot                         	       0x101f862fc EditorFileSystem::_update_scan_actions() + 4288 (editor_file_system.cpp:697)
5   Godot                         	       0x101f8b868 EditorFileSystem::_notification(int) + 496 (editor_file_system.cpp:1298)
6   Godot                         	       0x104c35090 Object::notification(int, bool) + 80
7   Godot                         	       0x102c768f0 SceneTree::_process_group(SceneTree::ProcessGroup*, bool) + 436
8   Godot                         	       0x102c74d0c SceneTree::_process(bool) + 824 (scene_tree.cpp:1039)
9   Godot                         	       0x102c75370 SceneTree::process(double) + 228 (scene_tree.cpp:526)
10  Godot                         	       0x10083f91c Main::iteration() + 1012 (main.cpp:4099)
11  Godot                         	       0x1007df23c OS_MacOS::run() + 148 (os_macos.mm:778)
12  Godot                         	       0x100809c08 main + 368 (godot_main_macos.mm:84)
13  dyld                          	       0x18f8d20e0 start + 2360

....

Thread 4 Crashed:
0   libsystem_kernel.dylib        	       0x18fc22a60 __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x18fc5ac20 pthread_kill + 288
2   libsystem_c.dylib             	       0x18fb67a30 abort + 180
3   Godot                         	       0x1007e39d4 handle_crash(int) + 2304 (crash_handler_macos.mm:176)
4   libsystem_platform.dylib      	       0x18fc8b584 _sigtramp + 56
5   Godot                         	       0x1022410a0 ProgressDialog::_popup() + 132 (progress_dialog.cpp:143)
6   Godot                         	       0x102241554 ProgressDialog::add_task(String const&, String const&, int, bool) + 616 (progress_dialog.cpp:197)
7   Godot                         	       0x101f8d84c EditorProgress::EditorProgress(String const&, String const&, int, bool) + 20 (editor_node.h:933) [inlined]
8   Godot                         	       0x101f8d84c EditorProgress::EditorProgress(String const&, String const&, int, bool) + 20 (editor_node.h:932) [inlined]
9   Godot                         	       0x101f8d84c EditorFileSystem::_update_scene_groups() + 156 (editor_file_system.cpp:1649)
10  Godot                         	       0x101f8944c EditorFileSystem::_update_pending_scene_groups() + 120
11  Godot                         	       0x101f8ef60 EditorFileSystem::update_files(Vector<String> const&) + 3252 (editor_file_system.cpp:1821)
12  Godot                         	       0x101f8e1c4 EditorFileSystem::update_file(String const&) + 392 (editor_file_system.cpp:1717)
13  Godot                         	       0x102072c74 EditorNode::_resource_saved(Ref<Resource>, String const&) + 84 (editor_node.cpp:6234)
14  Godot                         	       0x1048a6990 ResourceSaver::save(Ref<Resource> const&, String const&, unsigned int) + 900 (resource_saver.cpp:146)
15  Godot                         	       0x10248163c ResourceImporterDynamicFont::import(String const&, String const&, HashMap<StringName, Variant, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, Variant>>> const&, List<String, DefaultAllocator>*, List<String, DefaultAllocator>*, Variant*) + 4192 (resource_importer_dynamic_font.cpp:231)
16  Godot                         	       0x101f93ac4 EditorFileSystem::_reimport_file(String const&, HashMap<StringName, Variant, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, Variant>>> const&, String const&, Variant*) + 5344 (editor_file_system.cpp:2166)
17  Godot                         	       0x101f968e4 EditorFileSystem::_reimport_thread(unsigned int, EditorFileSystem::ImportThreadData*) + 120 (editor_file_system.cpp:2339)
18  Godot                         	       0x104c7f320 WorkerThreadPool::_process_task(WorkerThreadPool::Task*) + 320
19  Godot                         	       0x104c7fed0 WorkerThreadPool::_thread_function(void*) + 256 (worker_thread_pool.cpp:196)
20  Godot                         	       0x10472d08c Thread::callback(unsigned long long, Thread::Settings const&, void (*)(void*), void*) + 120 (thread.cpp:64)
21  Godot                         	       0x10472d3f4 decltype(std::declval<void (*)(unsigned long long, Thread::Settings const&, void (*)(void*), void*)>()(std::declval<unsigned long long>(), std::declval<Thread::Settings>(), std::declval<void (*)(void*)>(), std::declval<void*>())) std::__1::__invoke[abi:un170006]<void (*)(unsigned long long, Thread::Settings const&, void (*)(void*), void*), unsigned long long, Thread::Settings, void (*)(void*), void*>(void (*&&)(unsigned long long, Thread::Settings const&, void (*)(void*), void*), unsigned long long&&, Thread::Settings&&, void (*&&)(void*), void*&&) + 12 (invoke.h:340) [inlined]
22  Godot                         	       0x10472d3f4 void std::__1::__thread_execute[abi:un170006]<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (*)(unsigned long long, Thread::Settings const&, void (*)(void*), void*), unsigned long long, Thread::Settings, void (*)(void*), void*, 2ul, 3ul, 4ul, 5ul>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (*)(unsigned long long, Thread::Settings const&, void (*)(void*), void*), unsigned long long, Thread::Settings, void (*)(void*), void*>&, std::__1::__tuple_indices<2ul, 3ul, 4ul, 5ul>) + 16 (thread.h:227) [inlined]
23  Godot                         	       0x10472d3f4 void* std::__1::__thread_proxy[abi:un170006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (*)(unsigned long long, Thread::Settings const&, void (*)(void*), void*), unsigned long long, Thread::Settings, void (*)(void*), void*>>(void*) + 52 (thread.h:238)
24  libsystem_pthread.dylib       	       0x18fc5af94 _pthread_start + 136
25  libsystem_pthread.dylib       	       0x18fc55d34 thread_start + 8

from godot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.