Fix (unreported) inconsistent `name_map` during file reading.
Swapping some ID lists between Mains must invalidate the name_map cache. Note that in theory, at least WM type could be ignored by name_map cache, since it is a singleton. However, don't think it's worth adding extra complication here, for really marginal benefits. The overhead of rebuilding the name cache here is extremly small. For some reason, this issue did not show so far in master, only appeared in some branch work on improving (in)direct status of linked IDs... Go figure.
This commit is contained in:
parent
d6d5089c65
commit
de27925aea
|
@ -42,6 +42,7 @@
|
|||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_override.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_main_namemap.h"
|
||||
#include "BKE_preferences.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_scene.h"
|
||||
|
@ -212,6 +213,12 @@ 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);
|
||||
if (bmain->name_map != NULL) {
|
||||
BKE_main_namemap_destroy(&bmain->name_map);
|
||||
}
|
||||
if (bfd->main->name_map != NULL) {
|
||||
BKE_main_namemap_destroy(&bfd->main->name_map);
|
||||
}
|
||||
|
||||
/* In case of actual new file reading without loading UI, we need to regenerate the session
|
||||
* uuid of the UI-related datablocks we are keeping from previous session, otherwise their uuid
|
||||
|
|
|
@ -206,6 +206,9 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
|
|||
}
|
||||
|
||||
BLI_listbase_clear(&G_MAIN->wm);
|
||||
if (G_MAIN->name_map != NULL) {
|
||||
BKE_main_namemap_destroy(&G_MAIN->name_map);
|
||||
}
|
||||
|
||||
/* reset active window */
|
||||
CTX_wm_window_set(C, active_win);
|
||||
|
|
Loading…
Reference in New Issue