Despite common belief that "DEG::depsgraph" substrings in the back trace means
a bug in the dependency graph, the actual root of the problem goes to the fact
that node tree copying uses source tree and nodes for a temporary storage.
This makes it so multiple dependency graphs can not be reliably evaluated from
different threads if they are using same original node tree.
Solved by doing the following:
- Commonly used tree copying function (which is used by library manager) keeps source tree, nodes and sockets untouched.
- All the related areas (like node tree's callback) now have const qualifier on the input.
- Areas which needs to have those temporary pointers assigned are now using explicit function.
Would be really cool to get rid of those temporary pointers completely, but
this is a bit tricky due to hairy nature of the code. Can happen any time now
though: is easy enough to generalize the new pointers mapping.
Note that this change is only intended to solve the crash. The fact that icons
shouldn't be updated on playback will be fixed as a separate change.
@Brecht Van Lommel (brecht), @Clément Foucault (fclem), this is a threading related issue, so the fact that it doesn't
currently crash for me does not necessary mean it's indeed solved. Please give
it an extra test :)