GPv3: LinArt: Handle shared cache for v3.
Shared cache in GPv3 line art is created before `MOD_lineart_compute_feature_lines_v3`, the function will create its own cache and overwrite the old one, causing memory leak. Now all code paths have been fixed.
This commit is contained in:
@@ -5068,8 +5068,11 @@ bool MOD_lineart_compute_feature_lines_v3(Depsgraph *depsgraph,
|
||||
}
|
||||
}
|
||||
|
||||
LineartCache *lc = MOD_lineart_init_cache();
|
||||
*cached_result = lc;
|
||||
LineartCache *lc = *cached_result;
|
||||
if (!lc) {
|
||||
lc = MOD_lineart_init_cache();
|
||||
*cached_result = lc;
|
||||
}
|
||||
|
||||
ld = lineart_create_render_buffer_v3(scene,
|
||||
&lmd,
|
||||
|
||||
@@ -827,7 +827,7 @@ static void generate_strokes(ModifierData &md,
|
||||
lmd.flags,
|
||||
lmd.calculation_flags);
|
||||
|
||||
if (!(lmd.flags & MOD_LINEART_USE_CACHE)) {
|
||||
if ((!(lmd.flags & MOD_LINEART_USE_CACHE)) && (&first_lineart != &lmd)) {
|
||||
/* Clear local cache. */
|
||||
if (local_lc != first_lineart.shared_cache) {
|
||||
MOD_lineart_clear_cache(&local_lc);
|
||||
|
||||
Reference in New Issue
Block a user