[Bf-blender-cvs] [23d5ca8740d] undo-experiments: undoexp: Fix crash on NULL depsgraph in storage/restoring code.
Bastien Montagne
noreply at git.blender.org
Wed Jan 8 11:05:10 CET 2020
Commit: 23d5ca8740d98465f94bd025f8cd74ea823a0736
Author: Bastien Montagne
Date: Wed Jan 8 11:03:03 2020 +0100
Branches: undo-experiments
https://developer.blender.org/rB23d5ca8740d98465f94bd025f8cd74ea823a0736
undoexp: Fix crash on NULL depsgraph in storage/restoring code.
There are some cases where a depsgraph has 'no time' to be built (like
multi-steps undo's).
Plus I guess in multi-viewlayers/scenes cases...
===================================================================
M source/blender/blenkernel/intern/scene.c
===================================================================
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 27c0625f19a..bfaeae59960 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -2155,6 +2155,11 @@ GHash *BKE_scene_undo_depsgraphs_extract(Main *bmain)
BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, __func__);
for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
+ if (scene->depsgraph_hash == NULL) {
+ /* In some cases, e.g. when undo has to perform multiple steps at once, no depsgraph will be
+ * built so this pointer may be NULL. */
+ continue;
+ }
for (ViewLayer *view_layer = scene->view_layers.first; view_layer != NULL;
view_layer = view_layer->next) {
DepsgraphKey key;
@@ -2195,6 +2200,11 @@ void BKE_scene_undo_depsgraphs_restore(Main *bmain, GHash *depsgraph_extract)
Depsgraph **depsgraph_extract_ptr = (Depsgraph **)BLI_ghash_lookup_p(depsgraph_extract,
key_full);
+ if (depsgraph_extract_ptr == NULL) {
+ continue;
+ }
+ BLI_assert(*depsgraph_extract_ptr != NULL);
+
Depsgraph **depsgraph_scene_ptr = scene_get_depsgraph_p(
bmain, scene, view_layer, true, false);
BLI_assert(depsgraph_scene_ptr != NULL);
More information about the Bf-blender-cvs
mailing list