Fix T75489: Crash on deleting current workspace from the outliner

It should not be possible to delete the current workspace from the
outliner. Show an error message instead.
This commit is contained in:
Julian Eisel 2020-04-10 17:28:26 +02:00
parent 475d7d073a
commit d216a0b505
Notes: blender-bot 2023-02-14 03:03:03 +01:00
Referenced by issue #75489, Crash on deleting current workspace from the outliner
1 changed files with 9 additions and 0 deletions

View File

@ -54,6 +54,7 @@
#include "BKE_outliner_treehash.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_workspace.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
@ -473,6 +474,14 @@ static void id_delete(bContext *C, ReportList *reports, TreeElement *te, TreeSto
id->name);
return;
}
else if (te->idcode == ID_WS) {
BKE_workspace_id_tag_all_visible(bmain, LIB_TAG_DOIT);
if (id->tag & LIB_TAG_DOIT) {
BKE_reportf(
reports, RPT_WARNING, "Cannot delete currently visible workspace id '%s'", id->name);
return;
}
}
BKE_id_delete(bmain, id);