Skip to content

Conversation

@xuhuisheng
Copy link
Contributor

@xuhuisheng xuhuisheng commented Oct 28, 2025

Issue Description

When changed parameter value of Visual Shader, we will trigger a "changed" signal and invoke VisualShaderEditor::_param_property_changed(). Notification chain is as follows:

  • [1] visual_shader._set_preview_shader_parameter()
  • [2] visual_shader.emit_changed(), trigger "changed" signal
  • [3] ShaderMaterial::_shader_changed()
  • [3] ShaderMaterial::notify_property_list_changed(), trigger "property_list_changed" signal
  • [4] VisualShaderEditor::_update_preview_parameter_list()

In _update_preview_parameter_list(), we used get_shader_parameter_list() from RenderingServer to sync UI tree list. The problem is we need determine whether we need re-create parameter tree. Current behavior clean and re-create parameter tree all the time. But after re-created tree, VisualShaderEditor still want to focus to the previous selected node. But the tree is re-created, we cannot get the previous selected tree, so the select_node is nullptr, then crashed.

Solution

I checked the properties from RenderingServer and the current parameter list from Editor. If there is NO inserted or removed parameters, we donot need to re-create parameter tree. So we can prevent crash.

Also, I add a ERR_FAIL_NULL_MSG to prevent get_selected_node is null, that is for safe.

@xuhuisheng xuhuisheng requested review from a team as code owners October 28, 2025 07:02
@AThousandShips AThousandShips added bug topic:editor crash topic:shaders cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release labels Oct 28, 2025
@AThousandShips AThousandShips added this to the 4.6 milestone Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release crash topic:editor topic:shaders

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Visual Shader Crashes when Adjusting Float Parameter

2 participants