Minor comments about current usages of `BKE_main_namemap_destroy`.

This commit is contained in:
Bastien Montagne 2023-02-06 19:36:02 +01:00
parent 430cc9d7bf
commit 961d99d3a4
3 changed files with 5 additions and 0 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}