[Bf-blender-cvs] [c036ef13696] blender-v2.83-release: Fix T76392: Crash loading app-template with Load UI disabled
Campbell Barton
noreply at git.blender.org
Wed May 6 00:28:55 CEST 2020
Commit: c036ef136960addd27f00857815adbb190abdc89
Author: Campbell Barton
Date: Wed May 6 08:05:19 2020 +1000
Branches: blender-v2.83-release
https://developer.blender.org/rBc036ef136960addd27f00857815adbb190abdc89
Fix T76392: Crash loading app-template with Load UI disabled
===================================================================
M source/blender/blenloader/intern/versioning_defaults.c
===================================================================
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 8343895c8dd..9309a529ccf 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -368,7 +368,13 @@ static void blo_update_defaults_scene(Main *bmain, Scene *scene)
/**
* Update defaults in startup.blend, without having to save and embed the file.
- * This function can be emptied each time the startup.blend is updated. */
+ * This function can be emptied each time the startup.blend is updated.
+ *
+ * \note Screen data may be cleared at this point, this will happen in the case
+ * an app-template's data needs to be versioned when read-file is called with "Load UI" disabled.
+ * Versioning the screen data can be safely skipped without "Load UI" since the screen data
+ * will have been versioned when it was first loaded.
+ */
void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
{
/* For all app templates. */
@@ -479,24 +485,26 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
}
/* Workspaces. */
- wmWindow *win = ((wmWindowManager *)bmain->wm.first)->windows.first;
- for (WorkSpace *workspace = bmain->workspaces.first; workspace; workspace = workspace->id.next) {
- WorkSpaceLayout *layout = BKE_workspace_hook_layout_for_workspace_get(win->workspace_hook,
- workspace);
-
- /* Name all screens by their workspaces (avoids 'Default.###' names). */
- /* Default only has one window. */
- if (layout->screen) {
- bScreen *screen = layout->screen;
- BLI_strncpy(screen->id.name + 2, workspace->id.name + 2, sizeof(screen->id.name) - 2);
- BLI_libblock_ensure_unique_name(bmain, screen->id.name);
- }
+ LISTBASE_FOREACH (wmWindowManager *, wm, &bmain->wm) {
+ LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
+ LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
+ WorkSpaceLayout *layout = BKE_workspace_hook_layout_for_workspace_get(win->workspace_hook,
+ workspace);
+ /* Name all screens by their workspaces (avoids 'Default.###' names). */
+ /* Default only has one window. */
+ if (layout->screen) {
+ bScreen *screen = layout->screen;
+ BLI_strncpy(screen->id.name + 2, workspace->id.name + 2, sizeof(screen->id.name) - 2);
+ BLI_libblock_ensure_unique_name(bmain, screen->id.name);
+ }
- /* For some reason we have unused screens, needed until re-saving.
- * Clear unused layouts because they're visible in the outliner & Python API. */
- LISTBASE_FOREACH_MUTABLE (WorkSpaceLayout *, layout_iter, &workspace->layouts) {
- if (layout != layout_iter) {
- BKE_workspace_layout_remove(bmain, workspace, layout_iter);
+ /* For some reason we have unused screens, needed until re-saving.
+ * Clear unused layouts because they're visible in the outliner & Python API. */
+ LISTBASE_FOREACH_MUTABLE (WorkSpaceLayout *, layout_iter, &workspace->layouts) {
+ if (layout != layout_iter) {
+ BKE_workspace_layout_remove(bmain, workspace, layout_iter);
+ }
+ }
}
}
}
More information about the Bf-blender-cvs
mailing list