Skip to content

Commit

Permalink
Merge pull request #80089 from AThousandShips/editor_settings_fix
Browse files Browse the repository at this point in the history
Fix API hash related crash in `EditorSettings`
  • Loading branch information
akien-mga committed Aug 2, 2023
2 parents 6b38024 + e2a9130 commit f8ead6d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 12 deletions.
2 changes: 2 additions & 0 deletions editor/doc_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ void DocTools::generate(bool p_basic_types) {
default_value_valid = true;
}
}
} else if (name == "EditorSettings") {
// Special case for editor settings, to prevent hardware or OS specific settings to affect the result.
} else if (import_option) {
default_value = import_options_default[E.name];
default_value_valid = true;
Expand Down
1 change: 0 additions & 1 deletion editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6829,7 +6829,6 @@ EditorNode::EditorNode() {
// No scripting by default if in editor.
ScriptServer::set_scripting_enabled(false);

EditorSettings::ensure_class_registered();
EditorHelp::generate_doc();
SceneState::set_disable_placeholders(true);
ResourceLoader::clear_translation_remaps(); // Using no remaps if in editor.
Expand Down
9 changes: 0 additions & 9 deletions editor/editor_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,13 +878,6 @@ EditorSettings *EditorSettings::get_singleton() {
return singleton.ptr();
}

void EditorSettings::ensure_class_registered() {
ClassDB::APIType prev_api = ClassDB::get_current_api();
ClassDB::set_current_api(ClassDB::API_EDITOR);
GDREGISTER_CLASS(EditorSettings); // Otherwise it can't be unserialized.
ClassDB::set_current_api(prev_api);
}

void EditorSettings::create() {
// IMPORTANT: create() *must* create a valid EditorSettings singleton,
// as the rest of the engine code will assume it. As such, it should never
Expand All @@ -895,8 +888,6 @@ void EditorSettings::create() {
return;
}

ensure_class_registered();

String config_file_path;
Ref<ConfigFile> extra_config = memnew(ConfigFile);

Expand Down
1 change: 0 additions & 1 deletion editor/editor_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ class EditorSettings : public Resource {

static EditorSettings *get_singleton();

static void ensure_class_registered();
static void create();
void setup_language();
void setup_network();
Expand Down
2 changes: 1 addition & 1 deletion editor/register_editor_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void register_editor_types() {
GDREGISTER_CLASS(EditorScript);
GDREGISTER_CLASS(EditorSelection);
GDREGISTER_CLASS(EditorFileDialog);
GDREGISTER_ABSTRACT_CLASS(EditorSettings);
GDREGISTER_CLASS(EditorSettings);
GDREGISTER_CLASS(EditorNode3DGizmo);
GDREGISTER_CLASS(EditorNode3DGizmoPlugin);
GDREGISTER_ABSTRACT_CLASS(EditorResourcePreview);
Expand Down

0 comments on commit f8ead6d

Please sign in to comment.