[Bf-blender-cvs] [4bee1e1c8c3] master: Fix broken logic in lib_query that could lead to NULL id_owner pointer.
Bastien Montagne
noreply at git.blender.org
Wed Mar 11 14:37:44 CET 2020
Commit: 4bee1e1c8c390388b30fcadee3c4127b5b9e7f8c
Author: Bastien Montagne
Date: Wed Mar 11 14:35:03 2020 +0100
Branches: master
https://developer.blender.org/rB4bee1e1c8c390388b30fcadee3c4127b5b9e7f8c
Fix broken logic in lib_query that could lead to NULL id_owner pointer.
Issue revealed by own recent cleanup in rB8820ab4, and moticed by
@brecht, thanks.
Note that am not 100% sure whether we should allow call on lib_query
without a proper valid owner_id, for embedded data-blocks. But this can
be investifated later, so far things have been working like that.
===================================================================
M source/blender/blenkernel/intern/lib_query.c
===================================================================
diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c
index 2a66624f88f..b022cc1720b 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -587,7 +587,12 @@ static void library_foreach_ID_link(Main *bmain,
for (; id != NULL; id = (flag & IDWALK_RECURSE) ? BLI_LINKSTACK_POP(data.ids_todo) : NULL) {
data.self_id = id;
- data.owner_id = (id->flag & LIB_EMBEDDED_DATA) ? id_owner : data.self_id;
+ /* Note that we may call this functions sometime directly on an embedded ID, without any
+ * knowledge of the owner ID then.
+ * While not great, and that should be probably sanitized at some point, we cal live with it
+ * for now. */
+ data.owner_id = ((id->flag & LIB_EMBEDDED_DATA) != 0 && id_owner != NULL) ? id_owner :
+ data.self_id;
/* inherit_data is non-NULL when this function is called for some sub-data ID
* (like root nodetree of a material).
More information about the Bf-blender-cvs
mailing list