diff options
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 32 | ||||
-rw-r--r-- | source/blender/compositor/nodes/COM_ImageNode.cpp | 12 |
2 files changed, 27 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 01b41eb22cd..52f3c90754a 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -191,17 +191,21 @@ void BKE_image_de_interlace(Image *ima, int odd) /* ***************** ALLOC & FREE, DATA MANAGING *************** */ -static void image_free_buffers(Image *ima) +static void image_free_cahced_frames(Image *image) { ImBuf *ibuf; - - while ((ibuf = BLI_pophead(&ima->ibufs))) { + while ((ibuf = BLI_pophead(&image->ibufs))) { if (ibuf->userdata) { MEM_freeN(ibuf->userdata); ibuf->userdata = NULL; } IMB_freeImBuf(ibuf); } +} + +static void image_free_buffers(Image *ima) +{ + image_free_cahced_frames(ima); if (ima->anim) IMB_free_anim(ima->anim); ima->anim = NULL; @@ -2505,26 +2509,22 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int f /* check for new RenderResult */ if (ima->rr == NULL || frame != ima->rr->framenr) { - /* copy to survive not found multilayer image */ - RenderResult *oldrr = ima->rr; + if (ima->rr) { + /* Cached image buffers shares pointers with render result, + * need to ensure there's no image buffers are hanging around + * with dead links after freeing the render result. + */ + image_free_cahced_frames(ima); + RE_FreeRenderResult(ima->rr); + ima->rr = NULL; + } - ima->rr = NULL; ibuf = image_load_sequence_file(ima, iuser, frame); if (ibuf) { /* actually an error */ ima->type = IMA_TYPE_IMAGE; printf("error, multi is normal image\n"); } - // printf("loaded new result %p\n", ima->rr); - /* free result if new one found */ - if (ima->rr) { - // if (oldrr) printf("freed previous result %p\n", oldrr); - if (oldrr) RE_FreeRenderResult(oldrr); - } - else { - ima->rr = oldrr; - } - } if (ima->rr) { RenderPass *rpass = BKE_image_multilayer_index(ima->rr, iuser); diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp index 6e4bff460d1..d595afe6a78 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.cpp +++ b/source/blender/compositor/nodes/COM_ImageNode.cpp @@ -142,7 +142,17 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c /* without this, multilayer that fail to load will crash blender [#32490] */ if (is_multilayer_ok == false) { - convertToOperations_invalid(graph, context); + int index; + vector<OutputSocket *> &outputsockets = this->getOutputSockets(); + for (index = 0; index < outputsockets.size(); index++) { + const float warning_color[4] = {0.0f, 0.0f, 0.0f, 0.0f}; + SetColorOperation *operation = new SetColorOperation(); + operation->setChannels(warning_color); + + /* link the operation */ + this->getOutputSocket(index)->relinkConnections(operation->getOutputSocket()); + graph->addOperation(operation); + } } } else { |