-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix language server causing random crashes when use_threads is enabled #99861
base: master
Are you sure you want to change the base?
Fix language server causing random crashes when use_threads is enabled #99861
Conversation
e6a4c17
to
1fb39a0
Compare
Co-Authored-By: Adam Scott <[email protected]>
1aaab5a
to
3439575
Compare
@@ -49,6 +50,7 @@ class GDScriptTextDocument : public RefCounted { | |||
void willSaveWaitUntil(const Variant &p_param); | |||
void didSave(const Variant &p_param); | |||
|
|||
void reload_script(Ref<GDScript> to_reload_script); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void reload_script(Ref<GDScript> to_reload_script); | |
void reload_script(Ref<GDScript> p_to_reload_script); |
Prefix arguments with p_
@@ -35,6 +35,7 @@ | |||
|
|||
#include "core/io/file_access.h" | |||
#include "core/object/ref_counted.h" | |||
#include "modules/gdscript/gdscript.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include "modules/gdscript/gdscript.h" | |
class GDScript; |
Forward declare this
} | ||
} | ||
|
||
void GDScriptTextDocument::reload_script(Ref<GDScript> to_reload_script) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void GDScriptTextDocument::reload_script(Ref<GDScript> to_reload_script) { | |
void GDScriptTextDocument::reload_script(Ref<GDScript> p_to_reload_script) { |
For a few years, I’ve been experiencing random crashes in VS Code when saving GDScript files, and after a long time troubleshooting, I finally found the root cause.
The issue was that
ScriptEditor::reload_scripts
was being called directly on the language server thread whennetwork/language_server/use_thread
was enabled. This led to race conditions that would eventually cause the crashes.