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

Clearing one of the values of TypedArray in the inspector makes the value unable to be found by the find function #82716

Closed
kus04e4ek opened this issue Oct 3, 2023 · 2 comments · Fixed by #84237

Comments

@kus04e4ek
Copy link
Contributor

Godot version

v4.1.2.rc1.official [58f0cae] and v4.2.dev5.official [e3e2528]

System information

Godot v4.1.2.rc1 - Windows 10.0.19044 - Vulkan (Compatibility) - NVIDIA GeForce GTX 1650 (NVIDIA; 31.0.15.3742) - AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx (8 Threads)

Issue description

Clearing one of the values of a typed array in the inspector seems to just unreference value and not set it to <null>, so the value becomes <Object#null>. Array's find function seems to look for the <null> value and doesn't accept <Object#null>, even if in GDScript <Object#null> == <null>. So, when calling array.find(null) in the tool script, the function can't find anything. When the project is restarted or you run it, the values that were equal to <Object#null> will become <null>.
image

Steps to reproduce

  1. Export a typed array of Resource or any of the types that inherit from it;
  2. Set one of the values of a typed array to anything;
  3. Clear the value;
  4. Use array.find(null) in any of the tool scripts.

Minimal reproduction project

ArrayBug.zip

@kus04e4ek
Copy link
Contributor Author

Still a problem in v4.2.dev6.official [57a6813]

@KoBeWi
Copy link
Member

KoBeWi commented Oct 31, 2023

The MRP crashes on master.

CrashHandlerException: Program crashed
Engine version: Godot Engine v4.2.beta.custom_build (4363ae34fa3f52223ae78ff2f2c187ab99827e3a)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[0] SafeRefCount::_check_unref_safety (C:\godot_source\core\templates\safe_refcount.h:187)
[1] SafeRefCount::_check_unref_safety (C:\godot_source\core\templates\safe_refcount.h:187)
[2] SafeRefCount::unrefval (C:\godot_source\core\templates\safe_refcount.h:214)
[3] RefCounted::unreference (C:\godot_source\core\object\ref_counted.cpp:77)
[4] Variant::_clear_internal (C:\godot_source\core\variant\variant.cpp:1353)
[5] Variant::clear (C:\godot_source\core\variant\variant.h:304)
[6] Variant::~Variant (C:\godot_source\core\variant\variant.h:786)
[7] Variant::`scalar deleting destructor'
[8] CowData<Variant>::_unref (C:\godot_source\core\templates\cowdata.h:217)
[9] CowData<Variant>::~CowData<Variant> (C:\godot_source\core\templates\cowdata.h:416)
[10] Vector<Variant>::~Vector<Variant> (C:\godot_source\core\templates\vector.h:290)
[11] ArrayPrivate::~ArrayPrivate
[12] ArrayPrivate::`scalar deleting destructor'
[13] memdelete<ArrayPrivate> (C:\godot_source\core\os\memory.h:112)
[14] Array::_unref (C:\godot_source\core\variant\array.cpp:81)
[15] Array::~Array (C:\godot_source\core\variant\array.cpp:824)
[16] Array::`scalar deleting destructor'
[17] Variant::_clear_internal (C:\godot_source\core\variant\variant.cpp:1377)
[18] Variant::clear (C:\godot_source\core\variant\variant.h:304)
[19] Variant::~Variant (C:\godot_source\core\variant\variant.h:786)
[20] Variant::`scalar deleting destructor'
[21] GDScriptFunction::call (C:\godot_source\modules\gdscript\gdscript_vm.cpp:3553)
[22] GDScriptInstance::callp (C:\godot_source\modules\gdscript\gdscript.cpp:1896)
[23] Node::_gdvirtual__ready_call<0> (C:\godot_source\scene\main\node.h:322)
[24] Node::_notification (C:\godot_source\scene\main\node.cpp:188)
[25] Node::_notificationv (C:\godot_source\scene\main\node.h:49)
[26] CanvasItem::_notificationv (C:\godot_source\scene\main\canvas_item.h:45)
[27] Node2D::_notificationv (C:\godot_source\scene\2d\node_2d.h:37)
[28] Object::notification (C:\godot_source\core\object\object.cpp:839)
[29] Node::_propagate_ready (C:\godot_source\scene\main\node.cpp:232)
[30] Node::_propagate_ready (C:\godot_source\scene\main\node.cpp:223)
[31] Node::_set_tree (C:\godot_source\scene\main\node.cpp:2941)
[32] SceneTree::initialize (C:\godot_source\scene\main\scene_tree.cpp:450)
[33] OS_Windows::run (C:\godot_source\platform\windows\os_windows.cpp:1472)
[34] widechar_main (C:\godot_source\platform\windows\godot_windows.cpp:182)
[35] _main (C:\godot_source\platform\windows\godot_windows.cpp:204)
[36] main (C:\godot_source\platform\windows\godot_windows.cpp:218)
[37] WinMain (C:\godot_source\platform\windows\godot_windows.cpp:232)
[38] __scrt_common_main_seh (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[39] <couldn't map PC to fn name>
-- END OF BACKTRACE --

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants