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

Occasional crash when loading project with NoiseTexture #54269

Closed
briansemrau opened this issue Oct 26, 2021 · 2 comments
Closed

Occasional crash when loading project with NoiseTexture #54269

briansemrau opened this issue Oct 26, 2021 · 2 comments

Comments

@briansemrau
Copy link
Contributor

Godot version

4.0.dev (46a139a)

System information

W10

Issue description

When loading a project with several NoiseTexture resources, occasionally the engine will crash.

This is caused by a deferred call to _update_texture, in which the NoiseTexture instance has been freed. But, inside the Callable, ObjectDB::get_instance still returns data.

Call stack:

godot.windows.tools.64.exe!std::_Atomic_integral<unsigned int,4>::fetch_add(const unsigned int _Operand, const std::memory_order _Order) Line 1553 (c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\atomic:1553)
godot.windows.tools.64.exe!std::_Atomic_integral_facade<unsigned int>::fetch_sub(const unsigned int _Operand, const std::memory_order _Order) Line 1782 (c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\atomic:1782)
godot.windows.tools.64.exe!SafeNumeric<unsigned int>::decrement() Line 82 (c:\Users\brian\Documents\GitHub\mygodot4\core\templates\safe_refcount.h:82)
godot.windows.tools.64.exe!SafeRefCount::unrefval() Line 182 (c:\Users\brian\Documents\GitHub\mygodot4\core\templates\safe_refcount.h:182)
godot.windows.tools.64.exe!RefCounted::unreference() Line 76 (c:\Users\brian\Documents\GitHub\mygodot4\core\object\ref_counted.cpp:76)
godot.windows.tools.64.exe!Ref<Image>::unref() Line 220 (c:\Users\brian\Documents\GitHub\mygodot4\core\object\ref_counted.h:220)
godot.windows.tools.64.exe!Ref<Image>::ref(const Ref<Image> & p_from) Line 67 (c:\Users\brian\Documents\GitHub\mygodot4\core\object\ref_counted.h:67)
godot.windows.tools.64.exe!Ref<Image>::operator=(const Ref<Image> & p_from) Line 129 (c:\Users\brian\Documents\GitHub\mygodot4\core\object\ref_counted.h:129)
godot.windows.tools.64.exe!NoiseTexture::_set_texture_image(const Ref<Image> & p_image) Line 90 (c:\Users\brian\Documents\GitHub\mygodot4\modules\opensimplex\noise_texture.cpp:90)
godot.windows.tools.64.exe!NoiseTexture::_update_texture() Line 166 (c:\Users\brian\Documents\GitHub\mygodot4\modules\opensimplex\noise_texture.cpp:166)
godot.windows.tools.64.exe!call_with_variant_args_helper<NoiseTexture>(NoiseTexture * p_instance, void(NoiseTexture::*)() p_method, const Variant * * p_args, Callable::CallError & r_error, IndexSequence<> __formal) Line 228 (c:\Users\brian\Documents\GitHub\mygodot4\core\variant\binder_common.h:228)
godot.windows.tools.64.exe!call_with_variant_args_dv<NoiseTexture>(NoiseTexture * p_instance, void(NoiseTexture::*)() p_method, const Variant * * p_args, int p_argcount, Callable::CallError & r_error, const Vector<Variant> & default_values) Line 371 (c:\Users\brian\Documents\GitHub\mygodot4\core\variant\binder_common.h:371)
godot.windows.tools.64.exe!MethodBindT<NoiseTexture>::call(Object * p_object, const Variant * * p_args, int p_arg_count, Callable::CallError & r_error) Line 282 (c:\Users\brian\Documents\GitHub\mygodot4\core\object\method_bind.h:282)
godot.windows.tools.64.exe!Object::call(const StringName & p_method, const Variant * * p_args, int p_argcount, Callable::CallError & r_error) Line 832 (c:\Users\brian\Documents\GitHub\mygodot4\core\object\object.cpp:832)
godot.windows.tools.64.exe!Callable::call(const Variant * * p_arguments, int p_argcount, Variant & r_return_value, Callable::CallError & r_call_error) Line 62 (c:\Users\brian\Documents\GitHub\mygodot4\core\variant\callable.cpp:62)
godot.windows.tools.64.exe!MessageQueue::_call_function(const Callable & p_callable, const Variant * p_args, int p_argcount, bool p_show_error) Line 259 (c:\Users\brian\Documents\GitHub\mygodot4\core\object\message_queue.cpp:259)
godot.windows.tools.64.exe!MessageQueue::flush() Line 306 (c:\Users\brian\Documents\GitHub\mygodot4\core\object\message_queue.cpp:306)
godot.windows.tools.64.exe!SceneTree::physics_process(double p_time) Line 424 (c:\Users\brian\Documents\GitHub\mygodot4\scene\main\scene_tree.cpp:424)
godot.windows.tools.64.exe!Main::iteration() Line 2552 (c:\Users\brian\Documents\GitHub\mygodot4\main\main.cpp:2552)
godot.windows.tools.64.exe!OS_Windows::run() Line 641 (c:\Users\brian\Documents\GitHub\mygodot4\platform\windows\os_windows.cpp:641)

Steps to reproduce

Create a scene that uses noise textures (e.g. mesh with StandardMaterial with NoiseTexture as albedo)
Try loading the project several times.

Minimal reproduction project

No response

@Calinou Calinou added this to the 4.0 milestone Oct 26, 2021
@YuriSizov YuriSizov modified the milestones: 4.0, 4.1 Feb 27, 2023
@akien-mga
Copy link
Member

Can you still reproduce this in 4.0.3 and 4.1-beta3 or later?

@akien-mga akien-mga modified the milestones: 4.1, 4.2 Jun 23, 2023
@YuriSizov YuriSizov removed this from the 4.2 milestone Nov 14, 2023
@YuriSizov YuriSizov added this to the 4.3 milestone Nov 15, 2023
@YuriSizov
Copy link
Contributor

Seems like a duplicate of #58818, so I'm going to close this in favor of the other one since it has more discussion.

@YuriSizov YuriSizov closed this as not planned Won't fix, can't repro, duplicate, stale Nov 15, 2023
@AThousandShips AThousandShips removed this from the 4.3 milestone Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants