diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-04-04 15:56:32 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-04-04 15:58:52 +0300 |
commit | d59c2d12b1226afa3789b0ef142f8f6cc9356ead (patch) | |
tree | dfd6f50ab327b3b77994a661a449fa5ec09bbbb3 /source/blender/modifiers | |
parent | 0c7ec5896638480c8ed0a67d80026b83e4d12526 (diff) |
Fix modifier freeing code re. ID refcounting.
Free code should not handle ID refcounting at all. This has to be done
at higher level, since in some case we want to free (temp) data that
actually did not refcount at all its IDs.
This change seems to be working OK, but as usual in that area, only
lots of testing in real-case situation will say whether there are some
hidden bugs or not.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_displace.c | 10 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_meshsequencecache.c | 4 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_wave.c | 10 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgedit.c | 4 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgmix.c | 10 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgproximity.c | 10 |
6 files changed, 4 insertions, 44 deletions
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index d2d82ca23d2..72122fae6b4 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -81,14 +81,6 @@ static void copyData(ModifierData *md, ModifierData *target) modifier_copyData_generic(md, target); } -static void freeData(ModifierData *md) -{ - DisplaceModifierData *dmd = (DisplaceModifierData *) md; - if (dmd->texture) { - id_us_min(&dmd->texture->id); - } -} - static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { DisplaceModifierData *dmd = (DisplaceModifierData *)md; @@ -444,7 +436,7 @@ ModifierTypeInfo modifierType_Displace = { /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ freeData, + /* freeData */ NULL, /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, /* updateDepsgraph */ updateDepsgraph, diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c index f3038a60315..04de6fae336 100644 --- a/source/blender/modifiers/intern/MOD_meshsequencecache.c +++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c @@ -75,10 +75,6 @@ static void freeData(ModifierData *md) { MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md; - if (mcmd->cache_file) { - id_us_min(&mcmd->cache_file->id); - } - if (mcmd->reader) { #ifdef WITH_ALEMBIC CacheReader_free(mcmd->reader); diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 0c3781acb19..8fe29c78486 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -78,14 +78,6 @@ static void initData(ModifierData *md) wmd->defgrp_name[0] = 0; } -static void freeData(ModifierData *md) -{ - WaveModifierData *wmd = (WaveModifierData *) md; - if (wmd->texture) { - id_us_min(&wmd->texture->id); - } -} - static void copyData(ModifierData *md, ModifierData *target) { #if 0 @@ -383,7 +375,7 @@ ModifierTypeInfo modifierType_Wave = { /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ freeData, + /* freeData */ NULL, /* isDisabled */ NULL, /* updateDepgraph */ updateDepgraph, /* updateDepsgraph */ updateDepsgraph, diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index aeb3df42622..8d77747b45d 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -79,10 +79,6 @@ static void freeData(ModifierData *md) { WeightVGEditModifierData *wmd = (WeightVGEditModifierData *) md; curvemapping_free(wmd->cmap_curve); - - if (wmd->mask_texture) { - id_us_min(&wmd->mask_texture->id); - } } static void copyData(ModifierData *md, ModifierData *target) diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index 032e154e096..bd1f58e7d5e 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -126,14 +126,6 @@ static void initData(ModifierData *md) wmd->mask_tex_mapping = MOD_DISP_MAP_LOCAL; } -static void freeData(ModifierData *md) -{ - WeightVGMixModifierData *wmd = (WeightVGMixModifierData *) md; - if (wmd->mask_texture) { - id_us_min(&wmd->mask_texture->id); - } -} - static void copyData(ModifierData *md, ModifierData *target) { #if 0 @@ -427,7 +419,7 @@ ModifierTypeInfo modifierType_WeightVGMix = { /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ freeData, + /* freeData */ NULL, /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, /* updateDepsgraph */ updateDepsgraph, diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index cbc62cdace5..09991887f69 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -286,14 +286,6 @@ static void initData(ModifierData *md) wmd->max_dist = 1.0f; /* vert arbitrary distance, but don't use 0 */ } -static void freeData(ModifierData *md) -{ - WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *) md; - if (wmd->mask_texture) { - id_us_min(&wmd->mask_texture->id); - } -} - static void copyData(ModifierData *md, ModifierData *target) { #if 0 @@ -616,7 +608,7 @@ ModifierTypeInfo modifierType_WeightVGProximity = { /* applyModifierEM */ NULL, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ freeData, + /* freeData */ NULL, /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, /* updateDepsgraph */ updateDepsgraph, |