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

Avoid crashing on first installation #182

Closed
wants to merge 2 commits into from
Closed

Conversation

lw64
Copy link
Contributor

@lw64 lw64 commented Aug 15, 2023

Fixes #20

@lw64
Copy link
Contributor Author

lw64 commented Aug 15, 2023

The error that makes Godot crash for me now is that it doesn't know the symbol Terrain3dSurface in editor.gd line 27:
editor = Terrain3DEditor.new()

  1. Can Godot be made aware of this symbol somehow without restarting?
  2. or how can I recognize that it the plugin is run the first time and in that case open a dialog to restart godot?
  3. Would that even work because the error says it cannot "compile" the script. (Though the type name appears earlier already)

@TokisanGames
Copy link
Owner

Hmm, Maybe we need to make the change in C++, as jolt does, and catch it on the first load of the extension before any gdscript loads.

Here's where jolt registers with Godot
https://github.com/godot-jolt/godot-jolt/blob/74ea8f3401aded9c9b833f886dbb4fae7bcfad04/src/register_types.cpp

This function calls register_settings(), which is where it initiates the restart
https://github.com/godot-jolt/godot-jolt/blob/74ea8f3401aded9c9b833f886dbb4fae7bcfad04/src/servers/jolt_project_settings.cpp#L56

This will require some exploration and experimentation with the C++. If it's getting beyond your comfort zone you could just limit this PR to the load image changes.

Repository owner deleted a comment from lw64 Aug 15, 2023
@lw64
Copy link
Contributor Author

lw64 commented Aug 15, 2023

So this removes the error due to the script, but it still crashes for me. Not sure if its something completely different though:

WARNING: XCreateIC couldn't create wd.xic
     at: _create_window (platform/linuxbsd/x11/display_server_x11.cpp:5260)
ERROR: FATAL: Condition "!exists" is true.
   at: operator[] (./core/templates/hash_map.h:504)

================================================================
handle_crash: Program crashed with signal 4
Engine version: Godot Engine v4.1.1.stable.flathub (bd6af8e0ea69167dd0627f3bd54f9105bda0f8b5)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
ERROR: FATAL: Index p_index = 1 is out of bounds (size() = 0).
   at: get (./core/templates/cowdata.h:155)

if ClassDB.class_exists("Terrain3DEditor"):
first_run = true
OS.alert("Restart the editor to use the Terrain3D plugin")
return
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to run every time, not the first time after installing the plugin only. Alright, let's drop this commit and just go with the first commit which partially resolves the issue by removing the errors. Later someone will look into initiating a restart before the crash via C++. Thanks.

@TokisanGames TokisanGames changed the title WIP: editor: Try avoiding crashing by not preloading resources Avoid crashing on first installation Aug 28, 2023
@TokisanGames TokisanGames mentioned this pull request Aug 28, 2023
@TokisanGames
Copy link
Owner

Superseded by #196

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix initial import errors & crash
2 participants