Commit: 3d7697b3258384c52e6de52f93da567afb7917a4
Author: Bastien Montagne
Date:   Fri Jan 27 15:32:44 2023 +0100
Branches: master
https://developer.blender.org/rB3d7697b3258384c52e6de52f93da567afb7917a4

Tweak to previous commit: move checks on DNA deprecated data at the end of 
readfile code.

BKE blendfile should not be allowed to deal with DNA deprectaed data, so
move recent check in rB138b3815e528 into BLO readfile, in a new
`blo_read_file_checks` util that is being called at the very end of main
readfile code (`blo_read_file_internal` and `library_link_end`).

===================================================================

M       source/blender/blenkernel/intern/blendfile.cc
M       source/blender/blenloader/intern/readfile.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/blendfile.cc 
b/source/blender/blenkernel/intern/blendfile.cc
index b7294156cb2..68f37df9ca9 100644
--- a/source/blender/blenkernel/intern/blendfile.cc
+++ b/source/blender/blenkernel/intern/blendfile.cc
@@ -438,16 +438,6 @@ static void setup_app_data(bContext *C,
     /* We need to rebuild some of the deleted override rules (for UI feedback 
purpose). */
     BKE_lib_override_library_main_operations_create(bmain, true, nullptr);
   }
-
-  /* Sanity checks. */
-#ifndef NDEBUG
-  LISTBASE_FOREACH (wmWindowManager *, wm, &bmain->wm) {
-    LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
-      /* This pointer is deprecated and should always be nullptr. */
-      BLI_assert(win->screen == nullptr);
-    }
-  }
-#endif
 }
 
 static void setup_app_blend_file_data(bContext *C,
diff --git a/source/blender/blenloader/intern/readfile.cc 
b/source/blender/blenloader/intern/readfile.cc
index e2721820f96..a007daa0e82 100644
--- a/source/blender/blenloader/intern/readfile.cc
+++ b/source/blender/blenloader/intern/readfile.cc
@@ -3781,6 +3781,20 @@ static BHead *read_userdef(BlendFileData *bfd, FileData 
*fd, BHead *bhead)
 /** \name Read File (Internal)
  * \{ */
 
+/** Contains sanity/debug checks to be performed at the very end of the 
reading process (i.e. after
+ * data, liblink, linked data, etc. has been done). */
+static void blo_read_file_checks(Main *bmain)
+{
+#ifndef NDEBUG
+  LISTBASE_FOREACH (wmWindowManager *, wm, &bmain->wm) {
+    LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
+      /* This pointer is deprecated and should always be nullptr. */
+      BLI_assert(win->screen == nullptr);
+    }
+  }
+#endif
+}
+
 BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
 {
   BHead *bhead = blo_bhead_first(fd);
@@ -3963,6 +3977,9 @@ BlendFileData *blo_read_file_internal(FileData *fd, const 
char *filepath)
 
   BLI_assert(bfd->main->id_map == nullptr);
 
+  /* Sanity checks. */
+  blo_read_file_checks(bfd->main);
+
   return bfd;
 }
 
@@ -4582,6 +4599,9 @@ static void library_link_end(Main *mainl, FileData **fd, 
const int flag)
     blo_filedata_free(*fd);
     *fd = nullptr;
   }
+
+  /* Sanity checks. */
+  blo_read_file_checks(mainvar);
 }
 
 void BLO_library_link_end(Main *mainl, BlendHandle **bh, const 
LibraryLink_Params *params)

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to