diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-01-11 16:16:10 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2021-01-13 14:13:34 +0300 |
commit | 0f95f51361d73fbd8ba8d80b3b65da930dcf3b20 (patch) | |
tree | 9623b81453a47cc9049a755a9bd048a41b162f20 /source/blender/depsgraph/intern/depsgraph.cc | |
parent | 2cd091e9c70974703dd47845c5ad631035b849a4 (diff) |
Fix T83411: Crash when using a workspace/layout data path in a driver
Building IDs which are not covered by copy-on-write process was not
implemented, which was causing parameters block not present, and, hence
causing crashes in areas which expected parameters to present.
First part of this change is related on making it so Copy-on-Write is
optional for ID nodes in the dependency graph.
Second part is related on using a generic builder for all ID types
which were not covered by Copy-on-Write before.
The final part is related on making it so build_id() is properly
handling ParticleSettings and Grease Pencil Data. Before they were not
covered there at all, and they need special handling because they do
have own build functions.
Not sure it worth trying to split those parts, as they are related to
each other and are not really possible to be tested standalone. Open
for a second opinion though.
Possible nut-tightening is to re-organize build_id() function so
that every branch does return and have an assert at the end, so that
missing ID type in the switch statement is easier to spot even when
using compilers which do not report missing switch cases.
As for question "why not use default" the answer is: to make it more
explicit and clear what is a decision when adding new ID types. We do
not want to quietly fall-back to a non-copy-on-write case for a newly
added ID types.
Differential Revision: https://developer.blender.org/D10075
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph.cc')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index 17eeba55a27..3d30e7e79b9 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -142,6 +142,14 @@ static void clear_id_nodes_conditional(Depsgraph::IDDepsNodes *id_nodes, const F * datablock for her own dirty needs. */ continue; } + if (id_node->id_cow == id_node->id_orig) { + /* Copy-on-write version is not needed for this ID type. + * + * NOTE: Is important to not de-reference the original datablock here because it might be + * freed already (happens during main database free when some IDs are freed prior to a + * scene). */ + continue; + } if (!deg_copy_on_write_is_expanded(id_node->id_cow)) { continue; } |