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() {
36
36
void GdjLanguage::frame () {
37
37
#ifdef TOOLS_ENABLED
38
38
if (Engine::get_singleton ()->is_project_manager_hint ()) { return ; }
39
- TypeManager::get_instance ().update_all_exports_if_dirty ();
40
39
#endif
41
40
}
42
41
Original file line number Diff line number Diff line change @@ -141,19 +141,23 @@ void TypeManager::create_and_update_scripts(Vector<KtClass*>& classes) {
141
141
path_user_scripts.push_back (script);
142
142
}
143
143
}
144
+
145
+ update_all_exports_if_dirty ();
144
146
#endif
145
147
}
146
148
147
149
#ifdef TOOLS_ENABLED
148
150
void TypeManager::update_all_exports_if_dirty () {
149
- if (!types_dirty) return ;
150
151
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));
152
155
}
153
156
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));
155
160
}
156
- types_dirty = false ;
157
161
}
158
162
#endif
159
163
@@ -178,4 +182,4 @@ TypeManager* TypeManager::init() {
178
182
return native_instance;
179
183
}
180
184
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> {
53
53
Vector<Ref<PathScript>> path_user_scripts;
54
54
HashMap<String, StringName> filepath_to_name_map;
55
55
56
- bool types_dirty;
57
-
58
56
TypeManager (jni::JObject p_wrapped);
59
57
};
60
58
You can’t perform that action at this time.
0 commit comments