[Bf-blender-cvs] [961d99d3a47] master: Minor comments about current usages of `BKE_main_namemap_destroy`.
Bastien Montagne
noreply at git.blender.org
Mon Feb 6 19:36:41 CET 2023
Commit: 961d99d3a47be8bda0f09d176a659d4088ef6432
Author: Bastien Montagne
Date: Mon Feb 6 19:36:02 2023 +0100
Branches: master
https://developer.blender.org/rB961d99d3a47be8bda0f09d176a659d4088ef6432
Minor comments about current usages of `BKE_main_namemap_destroy`.
===================================================================
M source/blender/blenkernel/intern/blendfile.cc
M source/blender/blenkernel/intern/main.c
M source/blender/windowmanager/intern/wm_files.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/blendfile.cc b/source/blender/blenkernel/intern/blendfile.cc
index e151c671b06..4deaa6d2109 100644
--- a/source/blender/blenkernel/intern/blendfile.cc
+++ b/source/blender/blenkernel/intern/blendfile.cc
@@ -214,6 +214,8 @@ static void setup_app_data(bContext *C,
SWAP(ListBase, bmain->wm, bfd->main->wm);
SWAP(ListBase, bmain->workspaces, bfd->main->workspaces);
SWAP(ListBase, bmain->screens, bfd->main->screens);
+ /* NOTE: UI IDs are assumed to be only local data-blocks, so no need to call
+ * #BKE_main_namemap_clear here (otherwise, the swapping would fail in many funny ways). */
if (bmain->name_map != nullptr) {
BKE_main_namemap_destroy(&bmain->name_map);
}
diff --git a/source/blender/blenkernel/intern/main.c b/source/blender/blenkernel/intern/main.c
index 3e8ff957d53..46094ae2854 100644
--- a/source/blender/blenkernel/intern/main.c
+++ b/source/blender/blenkernel/intern/main.c
@@ -186,6 +186,7 @@ void BKE_main_free(Main *mainvar)
BKE_main_idmap_destroy(mainvar->id_map);
}
+ /* NOTE: `name_map` in libraries are freed together with the library IDs above. */
if (mainvar->name_map) {
BKE_main_namemap_destroy(&mainvar->name_map);
}
diff --git a/source/blender/windowmanager/intern/wm_files.cc b/source/blender/windowmanager/intern/wm_files.cc
index 4ee39b7d2db..e5d94fdd9b2 100644
--- a/source/blender/windowmanager/intern/wm_files.cc
+++ b/source/blender/windowmanager/intern/wm_files.cc
@@ -207,6 +207,8 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
BLI_listbase_clear(&G_MAIN->wm);
if (G_MAIN->name_map != nullptr) {
+ /* NOTE: UI IDs are assumed to be only local data-blocks, so no need to call
+ * #BKE_main_namemap_clear here. */
BKE_main_namemap_destroy(&G_MAIN->name_map);
}
More information about the Bf-blender-cvs
mailing list