Depsgraph: Fix crashes when OCIO configuration is missing
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 20 Jul 2017 13:00:09 +0000 (15:00 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 20 Jul 2017 13:00:09 +0000 (15:00 +0200)
We were creating copy on write version of scene prior to validating color management
settings for the original scene.

source/blender/blenkernel/intern/blendfile.c

index 6ac41c728155272a28277c6b06d7dd70a5581380..4de2433a89a8ab004366a1712694139d991a75e4 100644 (file)
@@ -332,11 +332,20 @@ static void setup_app_data(
                        }
                }
        }
+
+       /* Setting scene might require having a dependency graph, with copy on write
+        * we need to make sure we ensure scene has correct color management before
+        * constructing dependency graph.
+        */
+       if (mode != LOAD_UNDO) {
+               IMB_colormanagement_check_file_config(G.main);
+       }
+
        BKE_scene_set_background(G.main, curscene);
 
        if (mode != LOAD_UNDO) {
+               /* TODO(sergey): Can this be also move above? */
                RE_FreeAllPersistentData();
-               IMB_colormanagement_check_file_config(G.main);
        }
 
        MEM_freeN(bfd);