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`).
This commit is contained in:
Bastien Montagne 2023-01-27 15:32:44 +01:00
parent 138b3815e5
commit 3d7697b325
2 changed files with 20 additions and 10 deletions

View File

@ -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,

View File

@ -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)