You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
(Windows) _new() creates invalid Null instance of custom class / crashes in debug build #397
But on Windows, that _new() (and a couple others as well I assume) produce an invalid Null instance - and using that instance then goes on to cause crashes of course.
That is in a release build. In a debug build, it seems to crash during the _new() itself. Both the class's constructor and _init() function are called and executed without a crash, though.
I really cannot pinpoint where exactly the crash inside the _new() happens in a debug build.
You are of course very welcome to compile and run the demo of the module yourself to see the problem in action.
It is probably something wrong with my code, but given it all works fine on Linux, I'm a bit clueless as to what is going on.
changed the title [-](Windows) _new() creates invalid Null instance - no errors[/-][+](Windows) _new() creates invalid Null instance of custom class - no errors[/+]on Apr 17, 2020
Digging some further, even an empty custom class derived from Reference (no code other than one test function) will show this behavior, it seems as if on Windows, _new() simply will not produce anything usable.
Could this be an incompatibility between Godot itself and MSVC2017?
Using CustomClass.new() in GDScript works just fine and produces a usable instance, btw. Only in C++, _new() fails.
changed the title [-](Windows) _new() creates invalid Null instance of custom class - no errors[/-][+](Windows) _new() creates invalid Null instance of custom class / crashes in debug build[/+]on Apr 20, 2020
Activity
TheSHEEEP commentedon Apr 17, 2020
As an additional info, I am using the version tagged as "3.2" in git (as it is for a 3.2 project).
[-](Windows) _new() creates invalid Null instance - no errors[/-][+](Windows) _new() creates invalid Null instance of custom class - no errors[/+]TheSHEEEP commentedon Apr 20, 2020
Digging some further, even an empty custom class derived from Reference (no code other than one test function) will show this behavior, it seems as if on Windows, _new() simply will not produce anything usable.
Could this be an incompatibility between Godot itself and MSVC2017?
Using CustomClass.new() in GDScript works just fine and produces a usable instance, btw. Only in C++, _new() fails.
TheSHEEEP commentedon Apr 20, 2020
I was finally able to attach a debugger and show where inside of _new() the crash actually happens.
This is the stack trace:
1 Godot_v3_2_1_stable_win64 0x840f57
2 Godot_v3_2_1_stable_win64 0x840ff0
3 Godot_v3_2_1_stable_win64 0x28189b4
4 godot::___godot_icall_bool __icalls.hpp 6224 0x7ffb0efa6014
5 godot::Reference::init_ref Reference.cpp 31 0x7ffb0efa5f5a
6 godot::Refgodot::DetourCrowdAgent::ref_pointer Ref.hpp 33 0x7ffb0eec43b1
7 godot::Refgodot::DetourCrowdAgent::Refgodot::DetourCrowdAgent Ref.hpp 151 0x7ffb0eeb2673
8 godot::DetourNavigation::addAgent detournavigation.cpp 395 0x7ffb0eebd496
The crashing line inside of ___godot_icall_bool is this:
godot::api->godot_method_bind_ptrcall(mb, inst->_owner, args, &ret);And the values at that point are:
[-](Windows) _new() creates invalid Null instance of custom class - no errors[/-][+](Windows) _new() creates invalid Null instance of custom class / crashes in debug build[/+]TheSHEEEP commentedon Apr 20, 2020
After some help on the Discord, turns out this problem is known since last year... and there is a fix for it.
Which hasn't been merged in many months.