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

Create a Mesh for a CSGMesh3D will trigger caller thread can't call this function in this node #86381

Closed
jsjtxietian opened this issue Dec 21, 2023 · 1 comment · Fixed by #86538

Comments

@jsjtxietian
Copy link
Contributor

Tested versions

Godot v4.3.dev (3ce73e5)

System information

Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 (NVIDIA; 31.0.15.3619) - 11th Gen Intel(R) Core(TM) i7-11700K @ 3.60GHz (16 Threads)

Issue description

When debugging #86356, I noticed that sometimes when I use the mesh droplist of CSGMesh3d node to assign a new PrismMesh, It will give this error:

image

Caller thread can't call this function in this node (/root/@EditorNode@17141/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9463/@VSplitContainer@9282/@HSplitContainer@9284/@HSplitContainer@9286/@Control@9287/@SubViewportContainer@9288/@SubViewport@9289/3d/CSGMesh3D). Use call_deferred() or call_thread_group() instead.

I know it's only printed out when DEBUG_ENABLED, but better needs some consideration.

I did some quick test, it seems all mesh types that has a concrete shape will lead to this error (box, cylinder,quad,torus...), while arrayMesh or placeholderMesh will not trigger this error. Also after some operation, it seems the error will not be triggered everytime I set mesh.

Steps to reproduce

  1. Open or Create a new Scene
  2. Create a new CSGMesh3D
  3. Select PrismMesh as mesh type
  4. Reset mesh and choose other mesh types

Minimal reproduction project (MRP)

N/A

@jsjtxietian
Copy link
Contributor Author

Call stack:

 Node::get_description() Line 1196	C++
 Node3D::update_gizmos() Line 557	C++
 CSGMesh3D::_mesh_changed() Line 933	C++
 call_with_variant_args_helper<CSGMesh3D>(CSGMesh3D * p_instance=0x0000017b3ad4ee20, void(CSGMesh3D::*)() p_method=0x00007ff78c817100, const Variant * * p_args=0x0000000000000000, Callable::CallError & r_error={...}, IndexSequence<> __formal={...}) Line 308	C++
 call_with_variant_args<CSGMesh3D>(CSGMesh3D * p_instance=0x0000017b3ad4ee20, void(CSGMesh3D::*)() p_method=0x00007ff78c817100, const Variant * * p_args=0x0000000000000000, int p_argcount=0, Callable::CallError & r_error={...}) Line 418	C++
 CallableCustomMethodPointer<CSGMesh3D>::call(const Variant * * p_arguments=0x0000000000000000, int p_argcount=0, Variant & r_return_value={...}, Callable::CallError & r_call_error={...}) Line 99	C++
 Callable::callp(const Variant * * p_arguments=0x0000000000000000, int p_argcount=0, Variant & r_return_value={...}, Callable::CallError & r_call_error={...}) Line 58	C++
 Object::emit_signalp(const StringName & p_name={...}, const Variant * * p_args=0x0000000000000000, int p_argcount=0) Line 1128	C++
 Object::emit_signal<>(const StringName & p_name={...}) Line 922	C++
 Resource::emit_changed() Line 45	C++
 PrimitiveMesh::_update() Line 130	C++
 PrimitiveMesh::get_rid() Line 231	C++
 EditorMeshPreviewPlugin::generate(const Ref<Resource> & p_from={...}, const Vector2 & p_size={...}, Dictionary & p_metadata={...}) Line 709	C++
 EditorResourcePreview::_generate_preview(Ref<ImageTexture> & r_texture={...}, Ref<ImageTexture> & r_small_texture={...}, const EditorResourcePreview::QueueItem & p_item={...}, const String & cache_base={...}, Dictionary & p_metadata={...}) Line 157	C++
 EditorResourcePreview::_iterate() Line 234	C++
 EditorResourcePreview::_thread() Line 338	C++
 EditorResourcePreview::_thread_func(void * ud=0x0000017b220ca880) Line 103	C++
 Thread::callback(unsigned __int64 p_caller_id=28, const Thread::Settings & p_settings={...}, void(*)(void *) p_callback=0x00007ff78deaf4d0, void * p_userdata=0x0000017b220ca880) Line 63	C++
 [External Code]	
 thread_start<unsigned int (__cdecl*)(void *),1>(void * const parameter=0x0000017b371855f0) Line 97	C++
 [External Code]	

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