-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
GDExtension "RandomNumberGenerator rng;" crashes editor in 4.3 but not in 4.2 #95745
Comments
I found out that the line of code below makes the game crash as well in 4.3 but not 4.2: To solve it I replaced it by:
Looks like I was creating variables in the wrong way, but only now with this update Godot complained... |
This is intentional, see godotengine/godot-cpp#1446 (comment):
And if you read the the crash message you got, it tells you to use
Also, specifically for
So it should be created like this: Ref<RandomNumberGenerator> rng;
rng.instantiate(); |
Ok, thank you @raulsntos. Just to finalize, do you think using |
Considering how this should never have worked, I have mixed feelings about documenting it. But if there's a lot of users that were relying on the bug then maybe we could at least mention it. I'll leave the decision to the @godotengine/gdextension team. |
I'm also not crazy about documenting this on the "Upgrading..." page. However, I do think it would be really good to mention on a GDExtension page related to godot-cpp that |
Tested versions
Tested in Godot 4.3 official and Godot 4.2.2 official
System information
Windows 10 - Vulkan (Forward+) - RTX 3060 laptop - AMD Ryzen 5 5600H - 24GB RAM
Issue description
That's it, I'm migrating my project and I had to change
RandomNumberGenerator rng;
toRandomNumberGenerator* rng;
and now it doesn't crash anymore. I don't know if the bug here is from 4.2 or 4.3 because I don't know what's the expected behaviour😅. Here's the console output when the crash occurs:Another line of code that causes exactly the same error/crash is this one:
I fixed it by using this expression instead:
I believe they crash for the same reason.
Steps to reproduce
Scenario 1:
Define a variable from RandomNumberGenerator class in your .h file, compile GDExtension and open editor
Scenario 2:
Try to get the RID of a SphereShape3D() using the following line of code in your header:
RID cachedSphereRID = SphereShape3D().get_rid();
Minimal reproduction project (MRP)
N/A
The text was updated successfully, but these errors were encountered: