From ce78f5a24a46c55abe85e4c8c6ea919e9870dead Mon Sep 17 00:00:00 2001 From: ChengduLittleA Date: Mon, 28 Aug 2023 21:30:42 +0800 Subject: [PATCH 1/2] Fix #111607: Do not unregister internal nodes Registering a node with a `bl_idname` same as a built-in node will lead to crash because `rna_Node_unregister` does not check `nt->rna_ext.data` to see whether it's not null (which indicates whether this node is registered with python or not). Now fixed. --- source/blender/makesrna/intern/rna_nodetree.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_nodetree.cc b/source/blender/makesrna/intern/rna_nodetree.cc index 521e33d8220..cff8ab346fd 100644 --- a/source/blender/makesrna/intern/rna_nodetree.cc +++ b/source/blender/makesrna/intern/rna_nodetree.cc @@ -1768,7 +1768,9 @@ static bool rna_Node_unregister(Main * /*bmain*/, StructRNA *type) { bNodeType *nt = static_cast(RNA_struct_blender_type_get(type)); - if (!nt) { + /** `nt->rna_ext.data` is the python object. If it's nullptr then it's a + * internally registered node, thus can't unregister. */ + if (!nt || !nt->rna_ext.data) { return false; } -- 2.30.2 From 65f58de768fa446cb91d513d0881b80cfa581bba Mon Sep 17 00:00:00 2001 From: ChengduLittleA Date: Tue, 29 Aug 2023 09:47:56 +0800 Subject: [PATCH 2/2] Fix comment block and typo. --- source/blender/makesrna/intern/rna_nodetree.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_nodetree.cc b/source/blender/makesrna/intern/rna_nodetree.cc index cff8ab346fd..68e7b552f7f 100644 --- a/source/blender/makesrna/intern/rna_nodetree.cc +++ b/source/blender/makesrna/intern/rna_nodetree.cc @@ -1768,7 +1768,7 @@ static bool rna_Node_unregister(Main * /*bmain*/, StructRNA *type) { bNodeType *nt = static_cast(RNA_struct_blender_type_get(type)); - /** `nt->rna_ext.data` is the python object. If it's nullptr then it's a + /* `nt->rna_ext.data` is the python object. If it's nullptr then it's an * internally registered node, thus can't unregister. */ if (!nt || !nt->rna_ext.data) { return false; -- 2.30.2