Revision: 23743 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23743 Author: blendix Date: 2009-10-09 17:09:21 +0200 (Fri, 09 Oct 2009)
Log Message: ----------- 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. Modified Paths: -------------- trunk/blender/source/blender/editors/space_image/image_ops.c Modified: trunk/blender/source/blender/editors/space_image/image_ops.c =================================================================== --- trunk/blender/source/blender/editors/space_image/image_ops.c 2009-10-09 14:42:36 UTC (rev 23742) +++ trunk/blender/source/blender/editors/space_image/image_ops.c 2009-10-09 15:09:21 UTC (rev 23743) @@ -813,12 +813,25 @@ 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); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs