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:
authorJulian Eisel <eiseljulian@gmail.com>2020-01-15 19:46:50 +0300
committerJulian Eisel <eiseljulian@gmail.com>2020-01-15 19:48:45 +0300
commitca49643f3c254a0bdb75f9972880c62bf7f44c3e (patch)
treeacb83fd577eacbf0673992957366e8c6daf0f70d /source/blender/blenkernel/intern/workspace.c
parentc27acbcfb79f7194d97564ce57b25dd62933f589 (diff)
Fix T70965: Undo crash with specific file
Not sure how the WorkSpaceLayout.screen pointer could end up being NULL, but apparently that happens, or at least happened with older files. Rather than just adding NULL-checks, prefer not keeping around those invalid layouts at all.
Diffstat (limited to 'source/blender/blenkernel/intern/workspace.c')
-rw-r--r--source/blender/blenkernel/intern/workspace.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index 3e449fa6b25..f58c20a7d72 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -247,8 +247,12 @@ WorkSpaceLayout *BKE_workspace_layout_add(Main *bmain,
void BKE_workspace_layout_remove(Main *bmain, WorkSpace *workspace, WorkSpaceLayout *layout)
{
- id_us_min(&layout->screen->id);
- BKE_id_free(bmain, layout->screen);
+ /* Screen should usually be set, but we call this from file reading to get rid of invalid
+ * layouts. */
+ if (layout->screen) {
+ id_us_min(&layout->screen->id);
+ BKE_id_free(bmain, layout->screen);
+ }
BLI_freelinkN(&workspace->layouts, layout);
}