Fix and regression test for crash during node group updates #104696
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#104696
Loading…
Reference in New Issue
No description provided.
Delete Branch "LukasTonne/blender:nodes-undefined-group-tree-update-crash"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Node tree updates can crash if the tree contains a node group that points at an
"undefined" tree type. This can happen if the tree is linked from a library
and the path is lost, or if a custom (python) tree is used and the script is not
run.
The fix is to check if the node group type is valid ("registered") and return an empty list otherwise.
A regression test has been added to test updates with undefined group trees in future.
@ -0,0 +27,4 @@
namespace blender::bke::node::tests {
struct NodeTreeTestContext {
Did you use some other tests as reference here? How to decide what goes into
NodeTreeTestContext
and what intoNodeTreeTest
?Generally, I think the fix can be committed first without this test, but it's interesting to see how we could test this. Wouldn't mind adding this test separately, but I'd want to check if this is really initializing all the things that would have to be initialized.
Yes, i copied most of this from other tests, e.g.
blend_file_loading_base_test.cc
,lib_id_test.cc
.I only used the necessary parts for making node trees ID blocks and updating them. All the stuff in
SetUpTestSuite
/TearDownTestSuite
is for one-off initialization that can stay over multiple tests. The "context" is temporary stuff (make newMain
and a context) that gets thrown away after each test. Could do that in the virtualSetUp
/TearDown
for each fixture, but i like the explicitness of the "context". No strong opinion.Here's a for just the fix, into the release branch: #105564
@ -23,6 +23,11 @@ static const aal::RelationsInNode &get_relations_in_node(const bNode &node, Reso
{
if (node.is_group()) {
if (const bNodeTree *group = reinterpret_cast<const bNodeTree *>(node.id)) {
/* Undefined tree types have no relations */
Comment style, missing dot. Same in other places.
@ -24,2 +24,4 @@
if (node.is_group()) {
if (const bNodeTree *group = reinterpret_cast<const bNodeTree *>(node.id)) {
/* Undefined tree types have no relations */
if (!ntreeIsRegistered(const_cast<bNodeTree *>(group))) {
Better change
ntreeIsRegistered
to take aconst
node tree.This has already been done, so you can simply remove the const cast
b83c2a2548
to6677d69fbc
I kind of don't like the fact that adding node tests requires another Blender entry point that needs to call
BKE_idtype_init
and the like... This does not feel like a scalable solution. Comments like this (inBlendfileLoadingBaseTest::SetUpTestCase
) also show that this approach can be quite brittle and can lead to a fair amount of code duplication:I'd be more happy with a solution that just starts up Blender as usual and then runs some test code. This is the approach used by Python tests and by extension also geometry nodes tests.
Duplicating the initialization and teardown logic once for tests (besides
main
andWM_exit_ex
) might be ok, but more than that seems to be like too much duplication for me...Pull request closed