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:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user