Skip to content

GDExtension "RandomNumberGenerator rng;" crashes editor in 4.3 but not in 4.2 #95745

Closed
@NatGazer

Description

@NatGazer

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; to RandomNumberGenerator* 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:

Godot Engine v4.3.stable.official.77dcf97d8 - https://godotengine.org
Vulkan 1.3.278 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 3060 Laptop GPU

ERROR: BUG: Godot Object created without binding callbacks. Did you forget to use memnew()?
   at: (src\classes\wrapped.cpp:87)

================================================================
CrashHandlerException: Program crashed with signal 4
Engine version: Godot Engine v4.3.stable.official (77dcf97d82cbfe4e4615475fa52ca03da645dbd8)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] error(-1): no debug info in PE/COFF executable
[2] error(-1): no debug info in PE/COFF executable
[3] error(-1): no debug info in PE/COFF executable
[4] error(-1): no debug info in PE/COFF executable
[5] error(-1): no debug info in PE/COFF executable
[6] error(-1): no debug info in PE/COFF executable
[7] error(-1): no debug info in PE/COFF executable
[8] error(-1): no debug info in PE/COFF executable
[9] error(-1): no debug info in PE/COFF executable
[10] error(-1): no debug info in PE/COFF executable
[11] error(-1): no debug info in PE/COFF executable
[12] error(-1): no debug info in PE/COFF executable
[13] error(-1): no debug info in PE/COFF executable
[14] error(-1): no debug info in PE/COFF executable
[15] error(-1): no debug info in PE/COFF executable
[16] error(-1): no debug info in PE/COFF executable
[17] error(-1): no debug info in PE/COFF executable
[18] error(-1): no debug info in PE/COFF executable
[19] error(-1): no debug info in PE/COFF executable
[20] error(-1): no debug info in PE/COFF executable
[21] error(-1): no debug info in PE/COFF executable
[22] error(-1): no debug info in PE/COFF executable
[23] error(-1): no debug info in PE/COFF executable
-- END OF BACKTRACE --
================================================================

Another line of code that causes exactly the same error/crash is this one:

RID cachedSphereRID = SphereShape3D().get_rid();

I fixed it by using this expression instead:

SphereShape3D* sphere = memnew(SphereShape3D);
RID cachedSphereRID = sphere->get_rid();

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions