Page MenuHome

Fix T101001: crash setting texture node active in certain cases
ClosedPublic

Authored by Philipp Oeser (lichtwerk) on Sep 12 2022, 2:12 PM.

Details

Summary

Code from rBb0cb0a785475: Texture Paint: sync changing active texture in the Node Editor to the assumed a texture node node->id would
always be an image.
That is not true though:

  • could be an object (as reported here with the Point Density node)
  • could be a textblock (as in the IES Texture node)

Acting on these would crash when doing BKE_image_signal on them.

Now check specifically for nodes that actually hold an image (`Image
Texture` / Environment Texture) and do nothing otherwise.
Also check if an image is actually set in these nodes (if none is, the
Image Editor is now also untouched, previously the image in the Image
Editor was "cleared" here [set to NULL] -- which does not seems very
beneficial)

Diff Detail

Repository
rB Blender
Branch
T101001 (branched from master)
Build Status
Buildable 23709
Build 23709: arc lint + arc unit

Event Timeline

Philipp Oeser (lichtwerk) requested review of this revision.Sep 12 2022, 2:12 PM
Philipp Oeser (lichtwerk) created this revision.
source/blender/editors/space_node/node_edit.cc
716

Might it be simpler / more future proof to check the ID is an image?

This avoids copying node->type, SH_NODE_TEX_IMAGE, SH_NODE_TEX_ENVIRONMENT checks around.

check node id for being an image directly (instead of checking for node types that can hold an image)

This revision is now accepted and ready to land.Sep 20 2022, 8:20 AM