Skip to content

unpredictable errors with methods returning Ref #1300

@vinni-richburgh

Description

@vinni-richburgh

Godot version

4.1.2-stable

godot-cpp version

4.1.2

System information

MacOS 13 & 14, Apple Silicon

Issue description

I'm observing Ref-returning methods throwing errors and behaving unexpectedly.
This happens since the switch to 4.1 if I'm not mistaken.

This is the error:

E 0:00:00:0376   get_instance_binding_callbacks: Cannot find instance binding callbacks for class 'Shader'.
  <C++ Error>    Condition "callbacks_it == instance_binding_callbacks.end()" is true. Returning: nullptr
  <C++ Source>   /Users/user0/Documents/issue-project/gdextension/godot-cpp/src/core/class_db.cpp:321 @ get_instance_binding_callbacks()

In the example I provided the error should happen for the classes Shader, Image and ImageTexture.
The following method calls in node0.cpp are to blame.

godot::ResourceLoader::get_singleton()->load("res://gdextension/node0/shader.gdshader")
noise.get_seamless_image(512, 512)
godot::ImageTexture::create_from_image(noise_image)

Over on my main project I'm also observing this error related to AudioStreamPlayer::get_stream_playback.
Refs instantiated with memnew work like a charm, so issue #1057 might be related to this one?

Steps to reproduce

From the project's root directory run ./setup.sh. (nothing scary there, just setting up git and building w/ cmake)

Open the project in Godot and play the scene "sandbox.tscn".

Three errors (see Issue description) should be printed.

Also try renaming gdextension/lindenmayer_tree to gdextension/node1, adjust CMakeLists.txts and update the lib paths in node1.gdextension, recompile and the errors should be gone, which is very odd!

Minimal reproduction project

minimal-reproduction-proj.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis has been identified as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions