Skip to content
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

Using EditorSyntaxHighlighter in TextEdit crashes the project. #84983

Open
kitbdev opened this issue Nov 16, 2023 · 6 comments
Open

Using EditorSyntaxHighlighter in TextEdit crashes the project. #84983

kitbdev opened this issue Nov 16, 2023 · 6 comments

Comments

@kitbdev
Copy link
Contributor

kitbdev commented Nov 16, 2023

Godot version

Godot v4.2.rc (ad72de5)

System information

Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 (NVIDIA; 31.0.15.3598) - Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 Threads)

Issue description

The running project crashes without error message if a TextEdit (or CodeEdit) has EditorSyntaxHighlighter set for its syntax_highlighter.

Attaching a debugger to the running project says:

ERROR: Class 'EditorSyntaxHighlighter' can only be instantiated by editor.
   at: ClassDB::instantiate (core\object\class_db.cpp:364)
core\object\class_db.cpp:364 - Class 'EditorSyntaxHighlighter' can only be instantiated by editor.
ERROR: res://addons/eval_command/run_script.tscn:5 - Parse Error: Can't create sub resource of type: EditorSyntaxHighlighter
   at: ResourceLoaderText::load (scene\resources\resource_format_text.cpp:551)
scene\resources\resource_format_text.cpp:551 - res://addons/eval_command/run_script.tscn:5 - Parse Error: Can't create sub resource of type: EditorSyntaxHighlighter
ERROR: Failed loading resource: res://addons/eval_command/run_script.tscn. Make sure resources have been imported by opening the project in the editor at least once.
   at: (core\io\resource_loader.cpp:275)
Failed loading resource: res://addons/eval_command/run_script.tscn. Make sure resources have been imported by opening the project in the editor at least once.
ERROR: Failed loading scene: res://addons/eval_command/run_script.tscn.
   at: (main\main.cpp:3433)
Failed loading scene: res://addons/eval_command/run_script.tscn.

EditorSyntaxHighlighter should probably not be available to select.
Or if EditorSyntaxHighlighter is useful for plugins or something, there should be an error printed when attempting to use it when not in the editor.

Steps to reproduce

Add a TextEdit or a CodeEdit.
Set Highlighting > syntax_highlighter to a new EditorSyntaxHighlighter.
Run the current Scene.
The Scene tries to load and immediately closes.

Minimal reproduction project

N/A

@jsjtxietian
Copy link
Contributor

jsjtxietian commented Nov 17, 2023

Yes comfirmed. The error message is pretty clear, what should we do about this? at least it shouldn't crash.

Drag0storm added a commit to Drag0storm/godot that referenced this issue Apr 4, 2024
…rashes the project

Instead of crashing without any debug console information, it now at least creates an instance and gives a warning.
Not an ideal solution, since it doesn't say which object called the EditorSyntaxHighlighter.
tiagorodrigues35 pushed a commit to tiagorodrigues35/godot that referenced this issue Apr 5, 2024
…rashes the project

Instead of crashing without any debug console information, it now at least creates an instance and gives a warning.
Not an ideal solution, since it doesn't say which object called the EditorSyntaxHighlighter.
@AThousandShips
Copy link
Member

AThousandShips commented Apr 5, 2024

This doesn't crash, it fails to load the main scene, which is unrecoverable, it happens when you can't load other classes as well, I'd say it's to be expected, how would we gracefully recover from this otherwise?

I'm not even sure I'd call this a bug, this is user error

@kitbdev
Copy link
Contributor Author

kitbdev commented Apr 5, 2024

It makes sense that it doesn't work, but I think there should be an error message in the Output so it is obvious why.

@AThousandShips
Copy link
Member

AThousandShips commented Apr 5, 2024

There is? It says it can't load the scene, if call that obvious:

ERR_FAIL_NULL_V_MSG(scene, EXIT_FAILURE, "Failed loading scene: " + local_game_path + ".");

Maybe we could make it even more obvious to say "exiting game" but it says what is happening

@kitbdev
Copy link
Contributor Author

kitbdev commented Apr 5, 2024

Only when there is a console on the running project, nothing is shown in the editor.

@AThousandShips
Copy link
Member

That's unrelated to this, that's because the debugger hasn't had a chance to connect yet, that's tracked elsewhere, can't remember the actual issue right now

@AThousandShips AThousandShips removed the bug label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants