godotengine / godotengine/godot-cpp
Godot 4 String::operator+ crashes
- Dominant language
- C++
- Stars
- 2.7k
- Forks
- 809
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 8
Description
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::fetch_add (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\atomic:1471)
[1] std::_Atomic_integral::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::fetch_sub (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\atomic:1700)
[3] SafeNumeric::decrement (D:\Development\godot4-git\core\templates\safe_refcount.h:82)
[4] CowData::_unref (D:\Development\godot4-git\core\templates\cowdata.h:201)
[5] CowData::_ref (D:\Development\godot4-git\core\templates\cowdata.h:367)
[6] String::operator= (D:\Development\godot4-git\core\string\ustring.h:444)
[7] PtrToArg::encode (D:\Development\godot4-git\core\variant\method_ptrcall.h:116)
[8] OperatorEvaluatorAdd::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::apply<0> (D:\Development\xr_plugins\godot_openvr.4.0\godot-cpp\include\core\Godot.hpp:267)
[12] godot::__wrapped_method (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(..)`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.