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

Godot 4 String::operator+ crashes #570

Open
BastiaanOlij opened this issue Jun 15, 2021 · 3 comments
Open

Godot 4 String::operator+ crashes #570

BastiaanOlij opened this issue Jun 15, 2021 · 3 comments
Labels
bug This has been identified as a bug

Comments

@BastiaanOlij
Copy link
Collaborator

BastiaanOlij commented Jun 15, 2021

Working on my OpenVR plugin port to Godot 4 (using #524) I noticed that any time strings are concatenated we get a crash.

Should be reproduce able by simply doing something like: String value = String("A") + String("B")

This is the error report from OpenVR:

[0] std::_Atomic_integral<unsigned int,4>::fetch_add (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\atomic:1471)
[1] std::_Atomic_integral<unsigned int,4>::fetch_add (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\atomic:1471)
[2] std::_Atomic_integral_facade<unsigned int>::fetch_sub (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\atomic:1700)
[3] SafeNumeric<unsigned int>::decrement (D:\Development\godot4-git\core\templates\safe_refcount.h:82)
[4] CowData<char32_t>::_unref (D:\Development\godot4-git\core\templates\cowdata.h:201)
[5] CowData<char32_t>::_ref (D:\Development\godot4-git\core\templates\cowdata.h:367)
[6] String::operator= (D:\Development\godot4-git\core\string\ustring.h:444)
[7] PtrToArg<String>::encode (D:\Development\godot4-git\core\variant\method_ptrcall.h:116)
[8] OperatorEvaluatorAdd<String,String,String>::ptr_evaluate (D:\Development\godot4-git\core\variant\variant_op.cpp:51)
[9] godot::String::operator+ (D:\Development\xr_plugins\godot_openvr.4.0\godot-cpp\src\gen\String.cpp:1075)
[10] godot::OpenVRRenderModel::load_model (D:\Development\xr_plugins\godot_openvr.4.0\src\open_vr\OpenVRRenderModel.cpp:57)
[11] godot::_WrappedMethod<godot::OpenVRRenderModel,bool,godot::String>::apply<0> (D:\Development\xr_plugins\godot_openvr.4.0\godot-cpp\include\core\Godot.hpp:267)
[12] godot::__wrapped_method<godot::OpenVRRenderModel,bool,godot::String> (D:\Development\xr_plugins\godot_openvr.4.0\godot-cpp\include\core\Godot.hpp:294)
[13] NativeScriptInstance::call (D:\Development\godot4-git\modules\gdnative\nativescript\nativescript.cpp:727)
[14] Object::call (D:\Development\godot4-git\core\object\object.cpp:795)
[15] Variant::call (D:\Development\godot4-git\core\variant\variant_call.cpp:981)
[16] GDScriptFunction::call (D:\Development\godot4-git\modules\gdscript\gdscript_vm.cpp:1473)
[17] GDScriptInstance::call (D:\Development\godot4-git\modules\gdscript\gdscript.cpp:1487)
[18] Object::call (D:\Development\godot4-git\core\object\object.cpp:795)
[19] Variant::call (D:\Development\godot4-git\core\variant\variant_call.cpp:981)
[20] GDScriptFunction::call (D:\Development\godot4-git\modules\gdscript\gdscript_vm.cpp:1473)
[21] GDScriptInstance::call (D:\Development\godot4-git\modules\gdscript\gdscript.cpp:1487)
[22] ScriptInstance::call (D:\Development\godot4-git\core\object\script_language.cpp:322)
[23] Node::_notification (D:\Development\godot4-git\scene\main\node.cpp:58)
[24] Node::_notificationv (D:\Development\godot4-git\scene\main\node.h:45)
[25] Node3D::_notificationv (D:\Development\godot4-git\scene\3d\node_3d.h:52)
[26] VisualInstance3D::_notificationv (D:\Development\godot4-git\scene\3d\visual_instance_3d.h:40)
[27] GeometryInstance3D::_notificationv (D:\Development\godot4-git\scene\3d\visual_instance_3d.h:83)
[28] MeshInstance3D::_notificationv (D:\Development\godot4-git\scene\3d\mesh_instance_3d.h:40)
[29] Object::notification (D:\Development\godot4-git\core\object\object.cpp:827)
[30] SceneTree::_notify_group_pause (D:\Development\godot4-git\scene\main\scene_tree.cpp:811)
[31] SceneTree::process (D:\Development\godot4-git\scene\main\scene_tree.cpp:443)
[32] Main::iteration (D:\Development\godot4-git\main\main.cpp:2501)
[33] OS_Windows::run (D:\Development\godot4-git\platform\windows\os_windows.cpp:622)
[34] widechar_main (D:\Development\godot4-git\platform\windows\godot_windows.cpp:163)
[35] _main (D:\Development\godot4-git\platform\windows\godot_windows.cpp:185)
[36] main (D:\Development\godot4-git\platform\windows\godot_windows.cpp:199)
[37] __scrt_common_main_seh (D:\a01\_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[38] BaseThreadInitThunk

The line of code was: Utilities::print(String("Loading: ") + String(p_model_name));
I've worked around it by using String(..).format(..)

@BastiaanOlij BastiaanOlij added the bug This has been identified as a bug label Jun 15, 2021
@DMaroo
Copy link
Contributor

DMaroo commented Jun 30, 2021

@Zylann Could this be related to #567?

@Zylann
Copy link
Collaborator

Zylann commented Jun 30, 2021

Did you bisected it to that merge? When I reviewed it I could not see anything particularly wrong. I cannot test the new Godot 4 API yet though.

@DMaroo
Copy link
Contributor

DMaroo commented Jun 30, 2021

No. I did not bisect (I haven't yet reproduced the bug), however, if this bug was not present before, then I think that #567 could maybe be the one which introduced it. Again, this is just speculation. I'll try and let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This has been identified as a bug
Projects
None yet
Development

No branches or pull requests

3 participants