Skip to content
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 call to method of Variant return type fails with singletons #83097

Closed
konczg opened this issue Oct 10, 2023 · 1 comment · Fixed by #83054
Closed

GDExtension call to method of Variant return type fails with singletons #83097

konczg opened this issue Oct 10, 2023 · 1 comment · Fixed by #83054

Comments

@konczg
Copy link
Contributor

konczg commented Oct 10, 2023

Godot version

v4.2.dev.custom_build (544601a686eed6b35a346de1f7a5b607fcf8ce97)

System information

Ubuntu 20.04.6 LTS (Focal Fossa)

Issue description

The attached example project demonstrates a specific crash when a function with Variant return type is called on a registered singleton. This happens as MethodBind::bind_ptrcall() is called with r_return == nullptr.

Steps to reproduce

Commit IDs where the issue CAN be reproduced:

  • godot: 6b727eb
  • godot-cpp: ef2f63a00c5496cc325e8546acd743787e87a83d

Commit IDs where the issue CANNOT be reproduced:

  • godot: 3cf1bc0
  • godot-cpp: ef2f63a00c5496cc325e8546acd743787e87a83d

Steps to reproduce:

  • Build the project: scons .
  • Open and run in Godot 4.x

Expected result:

  • The project starts without issue

Actual result:

  • The project crashes with the following backtrace:
================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.2.dev.custom_build (544601a686eed6b35a346de1f7a5b607fcf8ce97)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x43090) [0x7f4f6fa50090] (??:0)
[2] /godot/godot/bin/godot.linuxbsd.editor.x86_64(+0x481bd44) [0x561fb48f3d44] (??:0)
[3] godot::Variant::clear() (??:0)
[4] godot::Variant::operator=(godot::Variant const&) (??:0)
[5] godot::MethodBindTR<godot::Variant>::ptrcall(void*, void const* const*, void*) const (??:0)
[6] /godot/godot/bin/godot.linuxbsd.editor.x86_64(+0x4802c71) [0x561fb48dac71] (??:0)
[7] /godot/godot/bin/godot.linuxbsd.editor.x86_64(+0x919517) [0x561fb09f1517] (??:0)
[8] /godot/godot/bin/godot.linuxbsd.editor.x86_64(+0x7ab488) [0x561fb0883488] (??:0)
[9] /godot/godot/bin/godot.linuxbsd.editor.x86_64(+0x26c250b) [0x561fb279a50b] (??:0)
[10] /godot/godot/bin/godot.linuxbsd.editor.x86_64(+0x2ccdfea) [0x561fb2da5fea] (??:0)
[11] /godot/godot/bin/godot.linuxbsd.editor.x86_64(+0x48502d0) [0x561fb49282d0] (??:0)
[12] /godot/godot/bin/godot.linuxbsd.editor.x86_64(+0x26afb16) [0x561fb2787b16] (??:0)
[13] /godot/godot/bin/godot.linuxbsd.editor.x86_64(+0x26afab8) [0x561fb2787ab8] (??:0)
[14] /godot/godot/bin/godot.linuxbsd.editor.x86_64(+0x26b1417) [0x561fb2789417] (??:0)
[15] /godot/godot/bin/godot.linuxbsd.editor.x86_64(+0x56e32d) [0x561fb064632d] (??:0)
[16] /godot/godot/bin/godot.linuxbsd.editor.x86_64(+0x55ac61) [0x561fb0632c61] (??:0)
[17] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f4f6fa31083] (??:0)
[18] /godot/godot/bin/godot.linuxbsd.editor.x86_64(+0x56bfce) [0x561fb0643fce] (??:0)
-- END OF BACKTRACE --
================================================================

Minimal reproduction project

gdextension_crash_example.zip

@dsnopek
Copy link
Contributor

dsnopek commented Oct 10, 2023

Thanks for the MRP!

I'm not sure what makes your example different than a very similar function in the automated tests for godot-cpp, but I can definitely get it to crash with your project.

I've updated PR #83054 with a change that fixes the crash for me

@github-project-automation github-project-automation bot moved this from Pending Decision to Done in 4.x Release Blockers Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants