[Bf-blender-cvs] [4e1a6b48e72] blender-v2.83-release: Fix T76559: Crash after deleting material leaves invalid pointer in node editor.

Bastien Montagne noreply at git.blender.org
Mon May 11 17:29:56 CEST 2020


Commit: 4e1a6b48e725186822117a9cce86e07ec85de28b
Author: Bastien Montagne
Date:   Mon May 11 17:24:56 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB4e1a6b48e725186822117a9cce86e07ec85de28b

Fix T76559: Crash after deleting material leaves invalid pointer in node editor.

No idea why node editor remap callback was only handling scene IDs (and
not any other ntree owner)...

Note that this should be a safe fix, but it unvails a nice can of worm,
at some point we should ba able to handle all of that through libquery
only, get rid of editor's remap callbacks, and probably sanitize usages
of ID pointers by some of them, like that nodetree editor.

Current situation remains a fairly fragile mess...

===================================================================

M	source/blender/editors/space_node/space_node.c

===================================================================

diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index b6ee393b991..9df04c097bb 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -855,19 +855,17 @@ static void node_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, ID *old_id, I
 {
   SpaceNode *snode = (SpaceNode *)slink;
 
-  if (GS(old_id->name) == ID_SCE) {
-    if (snode->id == old_id) {
-      /* nasty DNA logic for SpaceNode:
-       * ideally should be handled by editor code, but would be bad level call
-       */
-      BLI_freelistN(&snode->treepath);
-
-      /* XXX Untested in case new_id != NULL... */
-      snode->id = new_id;
-      snode->from = NULL;
-      snode->nodetree = NULL;
-      snode->edittree = NULL;
-    }
+  if (snode->id == old_id) {
+    /* nasty DNA logic for SpaceNode:
+     * ideally should be handled by editor code, but would be bad level call
+     */
+    BLI_freelistN(&snode->treepath);
+
+    /* XXX Untested in case new_id != NULL... */
+    snode->id = new_id;
+    snode->from = NULL;
+    snode->nodetree = NULL;
+    snode->edittree = NULL;
   }
   else if (GS(old_id->name) == ID_OB) {
     if (snode->from == old_id) {



More information about the Bf-blender-cvs mailing list