From 3f7db9c4b77a3645b6da77e30800a103a7632a53 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 15 Oct 2025 11:40:29 +0200 Subject: [PATCH] Fix #147759: Do not delete a library if it contains the active scene. Supporting this is fairly involved (see #147759 comments and !147827), so for 5.0 and active LTSs releases, best is to not delete a library if it contains the active scene. Pull Request: https://projects.blender.org/blender/blender/pulls/147831 --- .../editors/space_outliner/outliner_edit.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/space_outliner/outliner_edit.cc b/source/blender/editors/space_outliner/outliner_edit.cc index 03d6a9aa66f..b8d115080b0 100644 --- a/source/blender/editors/space_outliner/outliner_edit.cc +++ b/source/blender/editors/space_outliner/outliner_edit.cc @@ -498,9 +498,19 @@ static void id_delete_tag(bContext *C, ReportList *reports, TreeElement *te, Tre } } - if (te->idcode == ID_LI && ((Library *)id)->runtime->parent != nullptr) { - BKE_reportf(reports, RPT_WARNING, "Cannot delete indirectly linked library '%s'", id->name); - return; + if (te->idcode == ID_LI) { + Library *lib = blender::id_cast(id); + if (lib->runtime->parent != nullptr) { + BKE_reportf(reports, RPT_WARNING, "Cannot delete indirectly linked library '%s'", id->name); + return; + } + if (CTX_data_scene(C)->id.lib == lib) { + BKE_reportf(reports, + RPT_WARNING, + "Cannot delete library '%s', as it contains the currently active Scene", + id->name); + return; + } } if (id->tag & ID_TAG_INDIRECT) { BKE_reportf(reports, RPT_WARNING, "Cannot delete indirectly linked id '%s'", id->name);