diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2016-05-08 02:44:01 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2016-05-08 18:44:03 +0300 |
commit | cbaa25eb88a25852791d4f8b18fb9e9137fea401 (patch) | |
tree | 6c11d0aa36ac2f7aac07868262d38964237d0c10 /intern/cycles/render/film.cpp | |
parent | 6100c2d262c58c611ccc75a20cca23bf9f245767 (diff) |
Cycles: Fix two small memory leaks and deduplicate table freeing
This commit makes remove_table skip the freeing if the offset is
already set to invalid - or, if it wasn't, set it to invalid after freeing.
That's what the current code was already doing in the Manager classes,
this change allows them to just call remove without the additional code.
Also, two potential memory leaks where new tables were always allocated
without freeing the old ones are fixed.
Reviewers: sergey, dingto, brecht
Differential Revision: https://developer.blender.org/D1974
Diffstat (limited to 'intern/cycles/render/film.cpp')
-rw-r--r-- | intern/cycles/render/film.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/intern/cycles/render/film.cpp b/intern/cycles/render/film.cpp index abdd1c2cc8a..95cb10ab13b 100644 --- a/intern/cycles/render/film.cpp +++ b/intern/cycles/render/film.cpp @@ -428,6 +428,7 @@ void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene) /* update filter table */ vector<float> table = filter_table(filter_type, filter_width); + scene->lookup_tables->remove_table(&filter_table_offset); filter_table_offset = scene->lookup_tables->add_table(dscene, table); kfilm->filter_table_offset = (int)filter_table_offset; @@ -443,10 +444,7 @@ void Film::device_free(Device * /*device*/, DeviceScene * /*dscene*/, Scene *scene) { - if(filter_table_offset != TABLE_OFFSET_INVALID) { - scene->lookup_tables->remove_table(filter_table_offset); - filter_table_offset = TABLE_OFFSET_INVALID; - } + scene->lookup_tables->remove_table(&filter_table_offset); } bool Film::modified(const Film& film) |