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

GDNative: exporting properties crashes Godot at exit. #46839

Closed
Bromeon opened this issue Mar 9, 2021 · 2 comments · Fixed by #46844
Closed

GDNative: exporting properties crashes Godot at exit. #46839

Bromeon opened this issue Mar 9, 2021 · 2 comments · Fixed by #46844

Comments

@Bromeon
Copy link
Contributor

Bromeon commented Mar 9, 2021

See originating issue godot-rust/gdnative#706

Godot version:
3.2 branch, 311ca0c

OS/device including version:
Windows 10

Issue description:
I am using the Rust GDNative binding with a custom-built Godot version. Everything works fine, until I export a Rust field, to be accessible as a property from GDScript.

Then, the engine starts and appears to run normally, however it crashes on exit with the following log:

CrashHandlerException: Program crashed
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[0] <couldn't map PC to fn name>
[1] <couldn't map PC to fn name>
[2] NativeScriptLanguage::_unload_stuff (D:\godot\modules\gdnative\nativescript\nativescript.cpp:955)
[3] NativeScriptLanguage::finish (D:\godot\modules\gdnative\nativescript\nativescript.cpp:1077)
[4] ScriptServer::finish_languages (D:\godot\core\script_language.cpp:185)
[5] Main::cleanup (D:\godot\main\main.cpp:2247)
[6] widechar_main (D:\godot\platform\windows\godot_windows.cpp:164)
[7] _main (D:\godot\platform\windows\godot_windows.cpp:184)
[8] main (D:\godot\platform\windows\godot_windows.cpp:196)
[9] __scrt_common_main_seh (D:\agent\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[10] BaseThreadInitThunk
-- END OF BACKTRACE --

@toasteater had the suspicion it could be this commit (see link above):

Revision: 311ca0c6f23784dfa831d8f058a335f698dcc5ea
Author: geekrelief <[email protected]>
Date: 23.12.2020 15:23:41
Message:
Removes the gdnative library when no script (gdns) references it any longer. This enables hot reload for gdnative.

(cherry picked from commit cc5d8bb5adf46aef63828fb23095589e51cca783)
----
Modified: modules/gdnative/nativescript/nativescript.cpp

After building both this and the prior version, both toasteater and I can confirm that this is the first commit that leads to the crash.

Steps to reproduce:

Set up simplest possible GDNative Rust project, 1 single class (I used godot-rust's Hello World example).
Add an exported property to that class:

#[property]
my_property: u32

Launch Godot.
Exit... 💥

Minimal reproduction project:

My fork of godot-rust, crash branch

@akien-mga
Copy link
Member

CC @geekrelief @godotengine/gdnative

geekrelief added a commit to geekrelief/godot that referenced this issue Mar 9, 2021
…uncs are called

Co-authored-by: toasteater <[email protected]>
Co-authored-by: Jan Haller <[email protected]>
@geekrelief
Copy link
Contributor

Worked with @Bromeon and @toasteater on the fix.

@akien-mga akien-mga modified the milestones: 3.2, 3.3 Mar 17, 2021
akien-mga added a commit that referenced this issue Mar 29, 2021
fixes #46839, ensure library_classes is cleared and free funcs are ca…
akien-mga pushed a commit that referenced this issue Mar 29, 2021
…lled

Co-authored-by: toasteater <[email protected]>
Co-authored-by: Jan Haller <[email protected]>
(cherry picked from commit 58fa497)
geekrelief added a commit to geekrelief/godot that referenced this issue Apr 5, 2021
…uncs are called

Co-authored-by: toasteater <[email protected]>
Co-authored-by: Jan Haller <[email protected]>
(cherry picked from commit 58fa497)
lekoder pushed a commit to KoderaSoftwareUnlimited/godot that referenced this issue Apr 24, 2021
…uncs are called

Co-authored-by: toasteater <[email protected]>
Co-authored-by: Jan Haller <[email protected]>
(cherry picked from commit 58fa497)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants