mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 13:41:03 +00:00 
			
		
		
		
	Fix language server thread crash
Co-Authored-By: Adam Scott <ascott.ca@gmail.com> Co-Authored-By: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									77dcf97d82
								
							
						
					
					
						commit
						8dd330dee7
					
				
					 2 changed files with 15 additions and 3 deletions
				
			
		|  | @ -112,12 +112,21 @@ void GDScriptTextDocument::didSave(const Variant &p_param) { | |||
| 		} | ||||
| 
 | ||||
| 		scr->update_exports(); | ||||
| 		ScriptEditor::get_singleton()->reload_scripts(true); | ||||
| 		ScriptEditor::get_singleton()->update_docs_from_script(scr); | ||||
| 		ScriptEditor::get_singleton()->trigger_live_script_reload(scr->get_path()); | ||||
| 
 | ||||
| 		if (!Thread::is_main_thread()) { | ||||
| 			callable_mp(this, &GDScriptTextDocument::reload_script).call_deferred(scr); | ||||
| 		} else { | ||||
| 			reload_script(scr); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void GDScriptTextDocument::reload_script(Ref<GDScript> p_to_reload_script) { | ||||
| 	ScriptEditor::get_singleton()->reload_scripts(true); | ||||
| 	ScriptEditor::get_singleton()->update_docs_from_script(p_to_reload_script); | ||||
| 	ScriptEditor::get_singleton()->trigger_live_script_reload(p_to_reload_script->get_path()); | ||||
| } | ||||
| 
 | ||||
| lsp::TextDocumentItem GDScriptTextDocument::load_document_item(const Variant &p_param) { | ||||
| 	lsp::TextDocumentItem doc; | ||||
| 	Dictionary params = p_param; | ||||
|  |  | |||
|  | @ -36,6 +36,8 @@ | |||
| #include "core/io/file_access.h" | ||||
| #include "core/object/ref_counted.h" | ||||
| 
 | ||||
| class GDScript; | ||||
| 
 | ||||
| class GDScriptTextDocument : public RefCounted { | ||||
| 	GDCLASS(GDScriptTextDocument, RefCounted) | ||||
| protected: | ||||
|  | @ -49,6 +51,7 @@ protected: | |||
| 	void willSaveWaitUntil(const Variant &p_param); | ||||
| 	void didSave(const Variant &p_param); | ||||
| 
 | ||||
| 	void reload_script(Ref<GDScript> p_to_reload_script); | ||||
| 	void sync_script_content(const String &p_path, const String &p_content); | ||||
| 	void show_native_symbol_in_editor(const String &p_symbol_id); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ryan
						Ryan