Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-09-16 17:02:08 +0300
committerJacques Lucke <jacques@blender.org>2022-09-16 17:03:50 +0300
commit4d67a995d91f000971312356c14c21559954f63e (patch)
tree7d70728429faf5ddaf7e45d23164f883e12f72ff /source/blender/blenkernel
parent7042f4e4b2e3232da34fadfb83502d090809a211 (diff)
Fix: crash when evaluating geometry nodes after deleting an unlinked node
This was essentially a use-after-free issue. When a geometry nodes group changes it has to be preprocessed again before it can be evaluated. This part was working, the issue was that parent node groups have to be preprocessed as well, which was missing. The lazy-function graph cached on the parent node group was still referencing data that was freed when the child group changed. Now the depsgraph makes sure that all relevant geometry node groups are preprocessed again after a change. This issue was found by Simon Thommes.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_node_runtime.hh5
-rw-r--r--source/blender/blenkernel/intern/node_runtime.cc14
2 files changed, 7 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_node_runtime.hh b/source/blender/blenkernel/BKE_node_runtime.hh
index 194820aa4ba..c3e0460bdb1 100644
--- a/source/blender/blenkernel/BKE_node_runtime.hh
+++ b/source/blender/blenkernel/BKE_node_runtime.hh
@@ -160,10 +160,9 @@ class bNodeRuntime : NonCopyable, NonMovable {
namespace node_tree_runtime {
/**
- * Is executed when the depsgraph determines that something in the node group changed that will
- * affect the output.
+ * Is executed when the node tree changed in the depsgraph.
*/
-void handle_node_tree_output_changed(bNodeTree &tree_cow);
+void preprocess_geometry_node_tree_for_evaluation(bNodeTree &tree_cow);
class AllowUsingOutdatedInfo : NonCopyable, NonMovable {
private:
diff --git a/source/blender/blenkernel/intern/node_runtime.cc b/source/blender/blenkernel/intern/node_runtime.cc
index 00b78284791..8b5b8bbc8b7 100644
--- a/source/blender/blenkernel/intern/node_runtime.cc
+++ b/source/blender/blenkernel/intern/node_runtime.cc
@@ -14,16 +14,12 @@
namespace blender::bke::node_tree_runtime {
-void handle_node_tree_output_changed(bNodeTree &tree_cow)
+void preprocess_geometry_node_tree_for_evaluation(bNodeTree &tree_cow)
{
- if (tree_cow.type == NTREE_GEOMETRY) {
- /* Rebuild geometry nodes lazy function graph. */
- {
- std::lock_guard lock{tree_cow.runtime->geometry_nodes_lazy_function_graph_info_mutex};
- tree_cow.runtime->geometry_nodes_lazy_function_graph_info.reset();
- }
- blender::nodes::ensure_geometry_nodes_lazy_function_graph(tree_cow);
- }
+ BLI_assert(tree_cow.type == NTREE_GEOMETRY);
+ /* Rebuild geometry nodes lazy function graph. */
+ tree_cow.runtime->geometry_nodes_lazy_function_graph_info.reset();
+ blender::nodes::ensure_geometry_nodes_lazy_function_graph(tree_cow);
}
static void double_checked_lock(std::mutex &mutex, bool &data_is_dirty, FunctionRef<void()> fn)