diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 022cf82426a..bba1939f72b 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -3471,7 +3471,9 @@ EditorHelpHighlighter::HighlightData EditorHelpHighlighter::_get_highlight_data( } text_edits[p_language]->set_text(p_source); - scripts[p_language]->set_source_code(p_source); + if (scripts[p_language].is_valid()) { // See GH-89610. + scripts[p_language]->set_source_code(p_source); + } highlighters[p_language]->_update_cache(); HighlightData result; @@ -3561,16 +3563,18 @@ EditorHelpHighlighter::EditorHelpHighlighter() { #ifdef MODULE_MONO_ENABLED TextEdit *csharp_text_edit = memnew(TextEdit); - Ref csharp; - csharp.instantiate(); + // See GH-89610. + //Ref csharp; + //csharp.instantiate(); Ref csharp_highlighter; csharp_highlighter.instantiate(); csharp_highlighter->set_text_edit(csharp_text_edit); - csharp_highlighter->_set_edited_resource(csharp); + //csharp_highlighter->_set_edited_resource(csharp); + csharp_highlighter->_set_script_language(CSharpLanguage::get_singleton()); text_edits[LANGUAGE_CSHARP] = csharp_text_edit; - scripts[LANGUAGE_CSHARP] = csharp; + //scripts[LANGUAGE_CSHARP] = csharp; highlighters[LANGUAGE_CSHARP] = csharp_highlighter; #endif } @@ -3578,14 +3582,10 @@ EditorHelpHighlighter::EditorHelpHighlighter() { EditorHelpHighlighter::~EditorHelpHighlighter() { #ifdef MODULE_GDSCRIPT_ENABLED memdelete(text_edits[LANGUAGE_GDSCRIPT]); - scripts[LANGUAGE_GDSCRIPT].unref(); - highlighters[LANGUAGE_GDSCRIPT].unref(); #endif #ifdef MODULE_MONO_ENABLED memdelete(text_edits[LANGUAGE_CSHARP]); - scripts[LANGUAGE_CSHARP].unref(); - highlighters[LANGUAGE_CSHARP].unref(); #endif } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index eeb84cb79eb..6c63d9ff0dd 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -137,12 +137,22 @@ void EditorStandardSyntaxHighlighter::_update_cache() { } } - const Ref