Fix T100703: Crash in file reading with ID's referenced from the WM

Don't decrement ID reference counts as any ID references from the
window-managers will have already been freed.

Reviewed By: mont29

Ref D15808
This commit is contained in:
Campbell Barton 2022-08-30 19:24:45 +10:00
parent 16938ab7d4
commit a97ae83a09
Notes: blender-bot 2023-02-14 07:18:54 +01:00
Referenced by issue #100703, Crash in file reading with ID's referenced from the window manager
1 changed files with 4 additions and 1 deletions

View File

@ -610,7 +610,10 @@ void wm_close_and_free_all(bContext *C, ListBase *wmlist)
while ((wm = wmlist->first)) {
wm_close_and_free(C, wm);
BLI_remlink(wmlist, wm);
BKE_libblock_free_data(&wm->id, true);
/* Don't handle user counts as this is only ever called once #G_MAIN has already been freed via
* #BKE_main_free so any ID's referenced by the window-manager (from ID properties) will crash.
* See: T100703. */
BKE_libblock_free_data(&wm->id, false);
BKE_libblock_free_data_py(&wm->id);
MEM_freeN(wm);
}