godot-d / godot-d

D language bindings for the Godot Engine's GDNative API
MIT License
206 stars 20 forks source link

Crash using 32 bit libraries #38

Open matthew1006 opened 6 years ago

matthew1006 commented 6 years ago

Platform: Windows 7 64 bit (also tested on Ubuntu 64 bit) Godot version: 3.0.x and 3.1 32 bit Godot-d version: 0.0.6 (from dub) Compiler: LDC2 using msvc 2017

Issue: 32 bit Godot crashes as soon as any 32 bit godot-d library is loaded. Visual Studio debugger output as follows: Unhandled exception at 0x0F27FBAA (godot_d_test.dll) in godot.windows.tools.32.exe: 0xC0000005: Access violation reading location 0x1E584442.

The issue seems to be caused when calling Reference.reference [classes\godot\reference\package.d : line 65] from GodotNativeLibrary.godot_gdnative_init [godot\d\register.d : line 80]

Stack trace from Godot from just trying to open the editor with a 32 bit library included in the project:

C:\Godot\src\bin>CrashHandlerException: Program crashed
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[0] godot.reference.Reference.reference (C:\Users\********\AppData\Roaming\dub\packages\godot-d-0.0.6\godot-d\classes\godot\reference\package.d:65)
[1] NativeScriptLanguage::init_library (c:\godot\src\modules\gdnative\nativescript\nativescript.cpp:1471)
[2] NativeScriptLanguage::frame (c:\godot\src\modules\gdnative\nativescript\nativescript.cpp:1541)
[3] Main::iteration (c:\godot\src\main\main.cpp:1865)
[4] OS_Windows::run (c:\godot\src\platform\windows\os_windows.cpp:2740)
[5] widechar_main (c:\godot\src\platform\windows\godot_win.cpp:150)
[6] _main (c:\godot\src\platform\windows\godot_win.cpp:172)
[7] main (c:\godot\src\platform\windows\godot_win.cpp:184)
[8] __scrt_common_main_seh (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283)
[9] BaseThreadInitThunk
[10] RtlInitializeExceptionChain
-- END OF BACKTRACE --
matthew1006 commented 5 years ago

Looking into this a bit more is looks like there is some issue with threads and locking causing access violations.