[Bf-blender-cvs] [2f39ca38437] master: Cleanup BKE_id_free_ex().

Bastien Montagne noreply at git.blender.org
Tue Jan 15 11:09:40 CET 2019


Commit: 2f39ca38437d94a63ba020ef110b413ee3f7894b
Author: Bastien Montagne
Date:   Mon Jan 14 15:38:05 2019 +0100
Branches: master
https://developer.blender.org/rB2f39ca38437d94a63ba020ef110b413ee3f7894b

Cleanup BKE_id_free_ex().

Add 'missing' bpy code from BKE_libblock_free_ex(), now both functions
do exactly the same thing, only the later is less flexible (fewer
'exotic' behaviors supported, like handling IDs outside of bmain etc.).

Next step: nuke usages of BKE_libblock_free functions, makes no sense to
have twice the same code around!

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

M	source/blender/blenkernel/intern/library_remap.c

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

diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index 458d723c95a..a671b02cb67 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -846,7 +846,12 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i
 	}
 
 #ifdef WITH_PYTHON
+#  ifdef WITH_PYTHON_SAFETY
 	BPY_id_release(id);
+#  endif
+	if (id->py_instance) {
+		BPY_DECREF_RNA_INVALIDATE(id->py_instance);
+	}
 #endif
 
 	if ((flag & LIB_ID_FREE_NO_USER_REFCOUNT) == 0) {
@@ -856,7 +861,7 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i
 	BKE_libblock_free_datablock(id, flag);
 
 	/* avoid notifying on removed data */
-	if (bmain) {
+	if ((flag & LIB_ID_FREE_NO_MAIN) == 0) {
 		BKE_main_lock(bmain);
 	}
 
@@ -877,7 +882,7 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i
 
 	BKE_libblock_free_data(id, (flag & LIB_ID_FREE_NO_USER_REFCOUNT) == 0);
 
-	if (bmain) {
+	if ((flag & LIB_ID_FREE_NO_MAIN) == 0) {
 		BKE_main_unlock(bmain);
 	}



More information about the Bf-blender-cvs mailing list