File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,6 @@ void GdjLanguage::init() {
3636void GdjLanguage::frame () {
3737#ifdef TOOLS_ENABLED
3838 if (Engine::get_singleton ()->is_project_manager_hint ()) { return ; }
39- TypeManager::get_instance ().update_all_exports_if_dirty ();
4039#endif
4140}
4241
Original file line number Diff line number Diff line change @@ -141,19 +141,23 @@ void TypeManager::create_and_update_scripts(Vector<KtClass*>& classes) {
141141 path_user_scripts.push_back (script);
142142 }
143143 }
144+
145+ update_all_exports_if_dirty ();
144146#endif
145147}
146148
147149#ifdef TOOLS_ENABLED
148150void TypeManager::update_all_exports_if_dirty () {
149- if (!types_dirty) return ;
150151 for (const Ref<NamedScript>& script : named_user_scripts) {
151- script->update_exports ();
152+ // We have to delay the update_export. The engine is not fully initialized and scripts can cause undefined behaviors.
153+ JvmScript* ptr = script.ptr ();
154+ MessageQueue::get_singleton ()->push_callable (callable_mp (ptr, &NamedScript::update_exports));
152155 }
153156 for (const Ref<PathScript>& script : path_user_scripts) {
154- script->update_exports ();
157+ // We have to delay the update_export. The engine is not fully initialized and scripts can cause undefined behaviors.
158+ JvmScript* ptr = script.ptr ();
159+ MessageQueue::get_singleton ()->push_callable (callable_mp (ptr, &NamedScript::update_exports));
155160 }
156- types_dirty = false ;
157161}
158162#endif
159163
@@ -178,4 +182,4 @@ TypeManager* TypeManager::init() {
178182 return native_instance;
179183}
180184
181- TypeManager::TypeManager (jni::JObject p_wrapped) : JavaSingletonWrapper<TypeManager>(p_wrapped), types_dirty { false } {}
185+ TypeManager::TypeManager (jni::JObject p_wrapped) : JavaSingletonWrapper<TypeManager>(p_wrapped) {}
Original file line number Diff line number Diff line change @@ -53,8 +53,6 @@ class TypeManager : public JavaSingletonWrapper<TypeManager> {
5353 Vector<Ref<PathScript>> path_user_scripts;
5454 HashMap<String, StringName> filepath_to_name_map;
5555
56- bool types_dirty;
57-
5856 TypeManager (jni::JObject p_wrapped);
5957};
6058
You can’t perform that action at this time.
0 commit comments