From 3905cdd89a73378c91a84a2fa804d76728ff2e73 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 1 Aug 2025 12:58:31 +0200 Subject: [PATCH] Fix #143455: crash in Grease Pencil Shrinkwrap modifier when there is a dependency cycle The case when no mesh can be retrieved from the shrinkwrap target object can be retrieved was not handled. It was handled by `ensure_shrinkwrap_cache_data` but the calling function didn't check if the cache was actually created. `BKE_modifier_get_evaluated_mesh_from_evaluated_object` can return null for an object that would usually have a mesh but the object has not been evaluated yet, as can be the case when there is a depsgraph cycle. From my current understanding, the issue existed without 83325d1fd. Changing the hash just made the depsgraph do different scheduling decisions so that now the shrinkwrap was evaluated before the target object. The order in which these two things are evaluated is arbitrary when there is a depsgraph cycle. Pull Request: https://projects.blender.org/blender/blender/pulls/143757 --- .../blender/modifiers/intern/MOD_grease_pencil_shrinkwrap.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/modifiers/intern/MOD_grease_pencil_shrinkwrap.cc b/source/blender/modifiers/intern/MOD_grease_pencil_shrinkwrap.cc index 6e4902cd160..a445b0cf863 100644 --- a/source/blender/modifiers/intern/MOD_grease_pencil_shrinkwrap.cc +++ b/source/blender/modifiers/intern/MOD_grease_pencil_shrinkwrap.cc @@ -225,6 +225,9 @@ static void modify_geometry_set(ModifierData *md, const int frame = grease_pencil.runtime->eval_frame; ensure_shrinkwrap_cache_data(smd, *ctx); + if (!smd.cache_data) { + return; + } IndexMaskMemory mask_memory; const IndexMask layer_mask = modifier::greasepencil::get_filtered_layer_mask(