Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-05-17 11:35:03 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-05-17 11:38:16 +0300
commitf50cef95ef33085780c4d4c66f178abfc5ea21b0 (patch)
tree2acfa85b93201c5fd74b2e97288e134ce2b1bdf0 /source/blender/makesrna/intern/rna_main_api.c
parent32b5f24c2a9cdf3a7c1f2f695bbc8704eb159a12 (diff)
Report an error when trying to remove non-in-main datablock
After recent dependency graph API changes it became easy to violate ownership design (since its changed) and request removal of out-of-main temporary mesh. This confuses Blender and can cause crashes/locks. Fixes T64731: Blender freezes after assigning result of object.to_mesh()
Diffstat (limited to 'source/blender/makesrna/intern/rna_main_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index f6fee2580b8..abcaccd7b6b 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -125,6 +125,14 @@ static void rna_Main_ID_remove(Main *bmain,
bool do_ui_user)
{
ID *id = id_ptr->data;
+ if (id->tag & LIB_TAG_NO_MAIN) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "%s '%s' is outside of main database and can not be removed from it",
+ BKE_idcode_to_name(GS(id->name)),
+ id->name + 2);
+ return;
+ }
if (do_unlink) {
BKE_id_delete(bmain, id);
RNA_POINTER_INVALIDATE(id_ptr);