Change or unlink texture datablock used in node editor - segmentation fault
Closed, ResolvedPublic

Description

Texture datablocks can not be changed or unlinked if being used in node editor.

Tested with Blender svn41767, Ubuntu 32-bit.

Steps to reproduce:
1) Open the attachment.
2) Try to unlink "Tex" datablock in Textures panel by by clicking [x] button
or change "Tex" to "Texture" and you will get segfault.

Backtrace and test file are attached.

Details

Type
Bug

Sorry, but i can't reproduce your bug reported...

downloaded your attached file and tested it under win 7 64 bit Blender rev. 41885.
Unlinked the texture in texture propertie panel, no problem.

I'm also unable to redo the issue on Mac, maybe it's linux 32bit specific or so. For any developer who wants to investigate this, running it under valgrind may also give clues.

Or it's just been fixed since this revision, could you try this with an official buildbot build?
http://builder.blender.org/download/

Yes, I can still reproduce this with an official blender-2.60-r41903-linux-glibc27-i686 and with svn41904.

I've attached some additional info from GDB in deletemat_crashdata.txt. In valgrind the only thing I can see is "Invalid read of size 4" at ED_node_generic_update (node_draw.c:160), which is null pointer dereference.

Developer's note:
Crash happens because node's property is exposing into texture buttons. This property has got update function (rna_Node_update) which "extracts" node tree from ptr->id.data, but in case when this property is exposed into texture buttons, this ptr->id is an ID of editing material, not a NodeTree, so material datablock is used as nodetree.
Not sure if there's nicer solution that checking id type in update callback.

Brecht, make now you've got some thoughts? Thanks.

The pointer it got from the context was invalid, for nodes the ID should be the nodetree.

Fix in svn, thanks for the report.

Brecht Van Lommel (brecht) closed this task as "Resolved".Nov 16 2011, 2:50 PM