Fix T100173: fix missing removal of old name in BLO_update_defaults_startup_blend

If a screen had to be renamed, the old name was not removed from
the name map. Fixes T100173.
This commit is contained in:
Aras Pranckevicius 2022-08-03 19:09:21 +03:00
parent 06b6c004f5
commit 10c4734978
Notes: blender-bot 2023-02-14 06:00:50 +01:00
Referenced by issue #100173, Assert when opening sculpting template ("SRDefault.003" in name map but not in Main)
1 changed files with 2 additions and 0 deletions

View File

@ -45,6 +45,7 @@
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_main_namemap.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
#include "BKE_node.h"
@ -488,6 +489,7 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
if (layout->screen) {
bScreen *screen = layout->screen;
if (!STREQ(screen->id.name + 2, workspace->id.name + 2)) {
BKE_main_namemap_remove_name(bmain, &screen->id, screen->id.name + 2);
BLI_strncpy(screen->id.name + 2, workspace->id.name + 2, sizeof(screen->id.name) - 2);
BLI_libblock_ensure_unique_name(bmain, screen->id.name);
}