Skip to content

Commit db27b00

Browse files
authored
Fix inspector exports (#622)
1 parent da1356a commit db27b00

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/language/gdj_language.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ void GdjLanguage::init() {
3636
void 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

src/type_manager.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff 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
148150
void 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) {}

src/type_manager.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)