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:
authorCampbell Barton <ideasman42@gmail.com>2021-01-06 17:35:05 +0300
committerJeroen Bakker <jeroen@blender.org>2021-01-13 17:02:02 +0300
commit552e02f731afbf5b6cd55c8475ace6fbb2b229fb (patch)
treecca09e46e09dd901e682f9a7f1b3a3e743ebb767
parent91e5b9d5f706abe9afe9418e02293516495c9dc8 (diff)
Fix T82952: Crash changing mesh data block and switching scenes
Regression in 33ac3582bbd5551bdfbc7ef8856640b5e61888f8.
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 8e23199430a..e5ad54311fb 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -1203,7 +1203,12 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph,
* In this case the custom-data layers used wont always match in `me->runtime.batch_cache`.
* If we want to display regular mesh data, we should have a separate cache for the edit-mesh.
* See T77359. */
- const bool is_editmode = (me->edit_mesh != NULL) /* && DRW_object_is_in_edit_mode(ob) */;
+ const bool is_editmode = (me->edit_mesh != NULL) &&
+ /* In rare cases we have the edit-mode data but not the generated cache.
+ * This can happen when switching an objects data to a mesh which
+ * happens to be in edit-mode in another scene, see: T82952. */
+ (me->edit_mesh->mesh_eval_final !=
+ NULL) /* && DRW_object_is_in_edit_mode(ob) */;
/* This could be set for paint mode too, currently it's only used for edit-mode. */
const bool is_mode_active = is_editmode && DRW_object_is_in_edit_mode(ob);