Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-10-09 19:09:21 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-10-09 19:09:21 +0400
commitdfbe2f9974f8e6d45d821fc6a16e7d3d32cd5faa (patch)
tree171423da00050aa4c1f4974e292028439b63859c /source
parent8f57b368ca89b8fdd6e2c3bd4f0adf145ab820a1 (diff)
Fix for crash when saving a render result image, then rendering
again. The saved image would still point to the render buffer, which was freed again on render. This is not a real solution but avoids the crash for now.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_image/image_ops.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 91316fba4d0..d5bd736f307 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -813,12 +813,25 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
ibuf->userflags &= ~IB_BITMAPDIRTY;
/* change type? */
+ if(ima->type==IMA_TYPE_R_RESULT) {
+ ima->type= IMA_TYPE_IMAGE;
+
+ /* workaround to ensure the render result buffer is no longer used
+ * by this image, otherwise can crash when a new render result is
+ * created. */
+ if(ibuf->rect && !(ibuf->mall & IB_rect))
+ imb_freerectImBuf(ibuf);
+ if(ibuf->rect_float && !(ibuf->mall & IB_rectfloat))
+ imb_freerectfloatImBuf(ibuf);
+ if(ibuf->zbuf && !(ibuf->mall & IB_zbuf))
+ IMB_freezbufImBuf(ibuf);
+ if(ibuf->zbuf_float && !(ibuf->mall & IB_zbuffloat))
+ IMB_freezbuffloatImBuf(ibuf);
+ }
if( ELEM(ima->source, IMA_SRC_GENERATED, IMA_SRC_VIEWER)) {
ima->source= IMA_SRC_FILE;
ima->type= IMA_TYPE_IMAGE;
}
- if(ima->type==IMA_TYPE_R_RESULT)
- ima->type= IMA_TYPE_IMAGE;
/* name image as how we saved it */
len= strlen(name);