Fix #123769: Assert when saving a file with deleted workspaces.

Delete sceens when their workspace is deleted.

Also remove `IDTYPE_FLAGS_NEVER_UNUSED` tag from bScreen ID type, there
is no more point to keep these IDs around if they are not used, there
are supposed to be mere sub-data of the Workspaces.

Pull Request: https://projects.blender.org/blender/blender/pulls/129975
This commit is contained in:
Bastien Montagne
2024-11-07 15:41:39 +01:00
committed by Gitea
parent 4ba30cf82e
commit 320c77b963
2 changed files with 7 additions and 1 deletions

View File

@@ -170,7 +170,7 @@ IDTypeInfo IDType_ID_SCR = {
/*name_plural*/ N_("screens"),
/*translation_context*/ BLT_I18NCONTEXT_ID_SCREEN,
/*flags*/ IDTYPE_FLAGS_NO_COPY | IDTYPE_FLAGS_ONLY_APPEND | IDTYPE_FLAGS_NO_ANIMDATA |
IDTYPE_FLAGS_NO_MEMFILE_UNDO | IDTYPE_FLAGS_NEVER_UNUSED,
IDTYPE_FLAGS_NO_MEMFILE_UNDO,
/*asset_type_info*/ nullptr,
/*init_data*/ nullptr,

View File

@@ -257,6 +257,12 @@ bool ED_workspace_delete(WorkSpace *workspace, Main *bmain, bContext *C, wmWindo
}
}
/* Also delete managed sceens if they have no other users. */
LISTBASE_FOREACH (WorkSpaceLayout *, layout, &workspace->layouts) {
BKE_id_free_us(bmain, layout->screen);
layout->screen = nullptr;
}
BKE_id_free(bmain, &workspace->id);
return true;
}