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
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-09-16 13:37:19 +0300
committerBastien Montagne <bastien@blender.org>2021-09-16 15:30:56 +0300
commit4ec2bdbbda05f7460913b65b5b99621021f7f480 (patch)
tree2cccc628b603f588d6cc38e1f0910c1c25fd0159 /source
parent1d5cc52ef6c1e90ba0ddbd7f0440f20b96b2f321 (diff)
Cleanup: Add comment about 'make_local' callback of Brush doing bad thing.
Callbacks in IDTypeInfo should never affect other IDs if they are not embedded. We break this rule in some cases, at least each of those should be clearly commented about and get some security checks to try to avoid unexpected issues as much as possible.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/brush.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 22d4d00c1c5..d70b941695e 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -161,7 +161,13 @@ static void brush_make_local(Main *bmain, ID *id, const int flags)
if (brush->clone.image) {
/* Special case: ima always local immediately. Clone image should only have one user anyway. */
+ /* FIXME: Recursive calls affecting other non-embedded IDs are really bad and should be avoided
+ * in IDType callbacks. Higher-level ID management code usually does not expect such things and
+ * does not deal properly with it. */
+ /* NOTE: assert below ensures that the comment above is valid, and that that exception is
+ * acceptable for the time being. */
BKE_lib_id_make_local(bmain, &brush->clone.image->id, 0);
+ BLI_assert(brush->clone.image->id.lib == NULL && brush->clone.image->id.newid == NULL);
}
if (!force_local && !force_copy) {