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:
authorBastien Montagne <bastien@blender.org>2020-04-21 19:26:32 +0300
committerBastien Montagne <bastien@blender.org>2020-04-21 19:26:32 +0300
commitbc3aab3fa547e60d2361d5a50cdc79885bdc7355 (patch)
treea445f1e51b612b8ecd3d5a40045e56ca0e5fb9b4 /source/blender/blenkernel/intern/blendfile.c
parentb4993a903255bd589cdb7afe232cec9f80ca49dc (diff)
Fix T75893: Undo causes crash with "Load UI" disabled.
We need to re-generate a new session uuid for the UI-related data-blocks that are kept across file reading, when load UI is disabled. Otherwise there will be several IDs with same uuid, which is an ensured way to crash in new undo code.
Diffstat (limited to 'source/blender/blenkernel/intern/blendfile.c')
-rw-r--r--source/blender/blenkernel/intern/blendfile.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index 2a53a0b69a4..5c000fbcb36 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -201,6 +201,27 @@ static void setup_app_data(bContext *C,
SWAP(ListBase, bmain->workspaces, bfd->main->workspaces);
SWAP(ListBase, bmain->screens, bfd->main->screens);
+ /* In case of actual new file reading without loading UI, we need to regenerate the session
+ * uuid of the UI-related datablocks we are keeping from previous session, otherwise their uuid
+ * will collide with some generated for newly read data. */
+ if (mode != LOAD_UNDO) {
+ ID *id;
+ FOREACH_MAIN_LISTBASE_ID_BEGIN (&bfd->main->wm, id) {
+ BKE_lib_libblock_session_uuid_renew(id);
+ }
+ FOREACH_MAIN_LISTBASE_ID_END;
+
+ FOREACH_MAIN_LISTBASE_ID_BEGIN (&bfd->main->workspaces, id) {
+ BKE_lib_libblock_session_uuid_renew(id);
+ }
+ FOREACH_MAIN_LISTBASE_ID_END;
+
+ FOREACH_MAIN_LISTBASE_ID_BEGIN (&bfd->main->screens, id) {
+ BKE_lib_libblock_session_uuid_renew(id);
+ }
+ FOREACH_MAIN_LISTBASE_ID_END;
+ }
+
/* we re-use current window and screen */
win = CTX_wm_window(C);
curscreen = CTX_wm_screen(C);