Fix (unreported) missing clear of deprecated Window data on fileread.
rB7f564d74f9ed (6 years ago!) forgot to clear the deprecated `Window->screen` pointer on file read for recent-enough .blend files. This is required since a valid value is always written in .blend files for that pointer, to ensure backward compatibility. The issue was never detected so far because that pointer is explicitely reset to NULL after filewrite, which includes any memfile undostep write, and usually existing UI data is re-used instead of loading the one from the .blend file, so thedden assert in `blo_lib_link_restore` would never be triggered. Now moved the assert at the end of `setup_app_data` to ensure it always get checked.
This commit is contained in:
parent
1fd1d24265
commit
138b3815e5
Notes:
blender-bot
2023-02-13 11:50:11 +01:00
Referenced by commit 3d7697b325
, Tweak to previous commit: move checks on DNA deprecated data at the end of readfile code.
|
@ -438,6 +438,16 @@ 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,
|
||||
|
|
|
@ -2701,8 +2701,6 @@ void blo_lib_link_restore(Main *oldmain,
|
|||
* all workspaces), that one only focuses one current active screen, takes care of
|
||||
* potential local view, and needs window's scene pointer to be final... */
|
||||
lib_link_window_scene_data_restore(win, win->scene, cur_view_layer);
|
||||
|
||||
BLI_assert(win->screen == nullptr);
|
||||
}
|
||||
|
||||
lib_link_wm_xr_data_restore(id_map, &curwm->xr);
|
||||
|
|
|
@ -1297,7 +1297,7 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports))
|
|||
}
|
||||
}
|
||||
|
||||
/* New workspace design */
|
||||
/* New workspace design. */
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 1)) {
|
||||
do_version_workspaces_after_lib_link(bmain);
|
||||
}
|
||||
|
@ -1970,6 +1970,16 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Files from this version included do get a valid `win->screen` pointer written for backward
|
||||
* compatibility, however this should never be used nor needed, so clear these pointers here. */
|
||||
if (MAIN_VERSION_ATLEAST(bmain, 280, 1)) {
|
||||
for (wmWindowManager *wm = bmain->wm.first; wm; wm = wm->id.next) {
|
||||
LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
|
||||
win->screen = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 3)) {
|
||||
/* init grease pencil grids and paper */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "gpencil_paper_color[3]")) {
|
||||
|
|
Loading…
Reference in New Issue