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:
authorBastien Montagne <bastien@blender.org>2020-09-29 13:14:04 +0300
committerBastien Montagne <bastien@blender.org>2020-09-29 18:08:44 +0300
commit84b3f6e049b35f9fce799e23acfde79511480206 (patch)
tree5601e8d838efec321679efe5918294ef96d702b7 /source/blender/blenloader/intern
parentece8f69f856dc27b5ac1b10796ca9609457df5ec (diff)
Fix (unrepported) utterly broken logic in readfile for Workspaces.
Remove the attempt to update the active layout pointers of each window from whithin `direct_link_workspace`. This piece of code was a nonsense for at least to critical reasons: * Do not, never, ever, access data from another datablock within the direct_link_... functions. Just don't. Don't try to be smart. * Since it was trying (and failing) to update the active layout of every window for every workspace, it was effectively setting those `act_layout` pointers to NULL (remapping can only ever happen once, trying to remap and already remapped new pointer is bound to fail in any case). Luckily (and funnily), this piece of code was actually harmless, since setting the active layout would be overridden/redone later, in `lib_link_windowmanager`, when updating their `workspace_hook` in `lib_link_workspace_instance_hook`. Note that the similar horror with `WorkSpaceDataRelation->parent` (which points at a window) is kept for now, because that one is needed. Hope to refactor it soon though.
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r--source/blender/blenloader/intern/readfile.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index bd944ac32ac..fc8424970dc 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2572,7 +2572,7 @@ static void lib_link_workspaces(BlendLibReader *reader, WorkSpace *workspace)
}
}
-static void direct_link_workspace(BlendDataReader *reader, WorkSpace *workspace, const Main *main)
+static void direct_link_workspace(BlendDataReader *reader, WorkSpace *workspace)
{
BLO_read_list(reader, &workspace->layouts);
BLO_read_list(reader, &workspace->hook_layout_relations);
@@ -2581,18 +2581,14 @@ static void direct_link_workspace(BlendDataReader *reader, WorkSpace *workspace,
LISTBASE_FOREACH (WorkSpaceDataRelation *, relation, &workspace->hook_layout_relations) {
/* data from window - need to access through global oldnew-map */
+ /* XXX This is absolutely not acceptable. There is no acceptable reasons to mess with other
+ * ID's data in read code, and certainly never, ever in `direct_link_` functions.
+ * Kept for now because it seems to work, but it should be refactored. Probably store and use
+ * window's `winid`, just like it was already done for screens? */
relation->parent = newglobadr(reader->fd, relation->parent);
BLO_read_data_address(reader, &relation->value);
}
- /* Same issue/fix as in direct_link_workspace_link_scene_data: Can't read workspace data
- * when reading windows, so have to update windows after/when reading workspaces. */
- LISTBASE_FOREACH (wmWindowManager *, wm, &main->wm) {
- LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
- BLO_read_data_address(reader, &win->workspace_hook->act_layout);
- }
- }
-
LISTBASE_FOREACH (bToolRef *, tref, &workspace->tools) {
tref->runtime = NULL;
BLO_read_data_address(reader, &tref->properties);
@@ -6368,7 +6364,7 @@ static bool direct_link_id(FileData *fd, Main *main, const int tag, ID *id, ID *
direct_link_particlesettings(&reader, (ParticleSettings *)id);
break;
case ID_WS:
- direct_link_workspace(&reader, (WorkSpace *)id, main);
+ direct_link_workspace(&reader, (WorkSpace *)id);
break;
case ID_ME:
case ID_LT: