[Bf-blender-cvs] [7a353a70377] master: Fix T60350: Removed objects that are still in the outliner will crash Blender.

Bastien Montagne noreply at git.blender.org
Thu Jan 24 17:45:19 CET 2019


Commit: 7a353a703770ea1c63f24733fbb2e37eafcbf98c
Author: Bastien Montagne
Date:   Thu Jan 24 17:44:13 2019 +0100
Branches: master
https://developer.blender.org/rB7a353a703770ea1c63f24733fbb2e37eafcbf98c

Fix T60350: Removed objects that are still in the outliner will crash Blender.

We need to force UI to fully redraw, BKE_id_delete & co won't do that
for us.

===================================================================

M	source/blender/makesrna/intern/rna_main_api.c
M	source/blender/python/intern/bpy_rna_id_collection.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index af2f007307b..806b1f6521b 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -118,6 +118,7 @@
 #endif
 
 #include "WM_api.h"
+#include "WM_types.h"
 
 
 static void rna_idname_validate(const char *name, char *r_name)
@@ -135,6 +136,8 @@ static void rna_Main_ID_remove(
 	if (do_unlink) {
 		BKE_id_delete(bmain, id);
 		RNA_POINTER_INVALIDATE(id_ptr);
+		/* Force full redraw, mandatory to avoid crashes when running this from UI... */
+		WM_main_add_notifier(NC_WINDOW, NULL);
 	}
 	else if (ID_REAL_USERS(id) <= 0) {
 		const int flag = (do_id_user ? 0 : LIB_ID_FREE_NO_USER_REFCOUNT) |
diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c
index 3fc12d4cc54..2fa387a0709 100644
--- a/source/blender/python/intern/bpy_rna_id_collection.c
+++ b/source/blender/python/intern/bpy_rna_id_collection.c
@@ -44,6 +44,9 @@
 #include "DNA_object_types.h"
 #include "DNA_key_types.h"
 
+#include "WM_api.h"
+#include "WM_types.h"
+
 #include "bpy_capi_utils.h"
 #include "bpy_rna_id_collection.h"
 
@@ -351,6 +354,8 @@ static PyObject *bpy_batch_remove(PyObject *UNUSED(self), PyObject *args, PyObje
 		Py_DECREF(ids_fast);
 
 		BKE_id_multi_tagged_delete(bmain);
+		/* Force full redraw, mandatory to avoid crashes when running this from UI... */
+		WM_main_add_notifier(NC_WINDOW, NULL);
 	}
 	else {
 		goto error;



More information about the Bf-blender-cvs mailing list