From 68d6b73fde5885b266e6c8ce742455a82a14aea2 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 28 May 2020 12:13:16 +0200 Subject: Readfile: move all calls to 'id_us_ensure_real' to direct_link functions. That kind of 'own' ID management has really nothing to do in lib_link code. --- source/blender/blenloader/intern/readfile.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index e532ea17dca..d3c391a1595 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -691,7 +691,7 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab /* Important, consistency with main ID reading code from read_libblock(). */ lib->id.us = ID_FAKE_USERS(lib); - /* Matches lib_link_library(). */ + /* Matches direct_link_library(). */ id_us_ensure_real(&lib->id); BLI_strncpy(lib->name, filepath, sizeof(lib->name)); @@ -3581,8 +3581,6 @@ static void lib_link_workspaces(FileData *fd, Main *bmain, WorkSpace *workspace) { ID *id = (ID *)workspace; - id_us_ensure_real(id); - LISTBASE_FOREACH_MUTABLE (WorkSpaceLayout *, layout, &workspace->layouts) { layout->screen = newlibadr(fd, id->lib, layout->screen); @@ -3631,6 +3629,8 @@ static void direct_link_workspace(FileData *fd, WorkSpace *workspace, const Main } workspace->status_text = NULL; + + id_us_ensure_real(&workspace->id); } static void lib_link_workspace_instance_hook(FileData *fd, WorkSpaceInstanceHook *hook, ID *id) @@ -8551,11 +8551,12 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main) newmain->curlib = lib; lib->parent = NULL; + + id_us_ensure_real(&lib->id); } -static void lib_link_library(FileData *UNUSED(fd), Main *UNUSED(bmain), Library *lib) +static void lib_link_library(FileData *UNUSED(fd), Main *UNUSED(bmain), Library *UNUSED(lib)) { - id_us_ensure_real(&lib->id); } /* Always call this once you have loaded new library data to set the relative paths correctly -- cgit v1.2.3