[Bf-blender-cvs] [4058333] id-remap: Half-working workaround for image refcount in SpaceImage.
Bastien Montagne
noreply at git.blender.org
Thu Sep 24 13:21:18 CEST 2015
Commit: 4058333c49f927fb7f289af4fa85241030c00f43
Author: Bastien Montagne
Date: Thu Sep 24 13:10:20 2015 +0200
Branches: id-remap
https://developer.blender.org/rB4058333c49f927fb7f289af4fa85241030c00f43
Half-working workaround for image refcount in SpaceImage.
Our ID refcount handling is really flacky in many places, this is going to be a serious
issue for this work I'm afraid... :/
===================================================================
M source/blender/editors/space_image/space_image.c
===================================================================
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 0f65235..04448a2 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -988,8 +988,15 @@ static void image_id_remap(SpaceLink *slink, ID *old_id, ID *new_id)
if ((ID *)simg->image == old_id) {
simg->image = (Image *)new_id;
/* TODO_REMAP this does not work well. */
- id_us_min(old_id);
- id_us_plus(new_id);
+ /* SpaceImage image->id.us is nasty, uses id_us_ensure_real(),
+ * i.e. increasing it only if null, and never decreasing it ever. :|
+ * Until better handling, work around that as best as we can... */
+ if (old_id->us > 0) {
+ id_us_min(old_id);
+ }
+ if (new_id->us == 0) {
+ id_us_plus(new_id);
+ }
}
if ((ID *)simg->gpd == old_id) {
More information about the Bf-blender-cvs
mailing list