From 4b74b35322f247ce75251e941cfed6610a0477e8 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 19 Mar 2020 19:50:34 +0100 Subject: Fix Cycles crash in Windows debug mode with volumes --- intern/cycles/render/attribute.cpp | 2 +- intern/cycles/render/attribute.h | 4 ++++ intern/cycles/render/image.cpp | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'intern') diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp index a3d3c1c2bda..4c26d5e8365 100644 --- a/intern/cycles/render/attribute.cpp +++ b/intern/cycles/render/attribute.cpp @@ -48,7 +48,7 @@ Attribute::Attribute( Attribute::~Attribute() { /* For voxel data, we need to free the image handle. */ - if (element == ATTR_ELEMENT_VOXEL) { + if (element == ATTR_ELEMENT_VOXEL && buffer.size()) { ImageHandle &handle = data_voxel(); handle.~ImageHandle(); } diff --git a/intern/cycles/render/attribute.h b/intern/cycles/render/attribute.h index 351357a7f7a..5871fa04a31 100644 --- a/intern/cycles/render/attribute.h +++ b/intern/cycles/render/attribute.h @@ -59,7 +59,11 @@ class Attribute { AttributeElement element, Geometry *geom, AttributePrimitive prim); + Attribute(Attribute &&other) = default; + Attribute(const Attribute &other) = delete; + Attribute &operator=(const Attribute &other) = delete; ~Attribute(); + void set(ustring name, TypeDesc type, AttributeElement element); void resize(Geometry *geom, AttributePrimitive prim, bool reserve_only); void resize(size_t num_elements); diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index 40fdf4b4119..67ed1176171 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -119,6 +119,9 @@ void ImageHandle::clear() foreach (const int slot, tile_slots) { manager->remove_image_user(slot); } + + tile_slots.clear(); + manager = NULL; } bool ImageHandle::empty() -- cgit v1.2.3