Commit: b1eff080bdaf64b35ab9bf28c94715599f70be73
Author: Dalai Felinto
Date:   Wed Oct 28 14:05:49 2015 -0200
Branches: blender-v2.76-release
https://developer.blender.org/rBb1eff080bdaf64b35ab9bf28c94715599f70be73

Temporary "fix" for crash when saving OpenEXR Multi-View from Image Editor

===================================================================

M       source/blender/imbuf/intern/openexr/openexr_api.cpp

===================================================================

diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp 
b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index c3fb43b..80a4a33 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -32,6 +32,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <stddef.h>
+#include <stdexcept>
 #include <fstream>
 #include <string>
 #include <set>
@@ -427,6 +428,14 @@ static bool imb_save_openexr_half(ImBuf *ibuf, const char 
*name, const int flags
                        const size_t offset = view_id * width * height;
                        RGBAZ *to = pixels + offset;
 
+                       /* TODO (dfelinto)
+                        * In some cases we get NULL ibufs, it needs 
investigation, meanwhile prevent crash
+                        * Multiview Render + Image Editor + OpenEXR + 
Multi-View
+                        */
+                       if (view_ibuf == NULL) {
+                               throw std::runtime_error(std::string("Missing 
data to write to ") + name);
+                       }
+
                        /* indicate used buffers */
                        frameBuffer.insert(insertViewName("R", views, view_id), 
Slice(HALF,  (char *) &pixels[offset].r, xstride, ystride));
                        frameBuffer.insert(insertViewName("G", views, view_id), 
Slice(HALF,  (char *) &pixels[offset].g, xstride, ystride));
@@ -541,6 +550,14 @@ static bool imb_save_openexr_float(ImBuf *ibuf, const char 
*name, const int flag
                        float *rect[4] = {NULL, NULL, NULL, NULL};
                        ImBuf *view_ibuf = is_multiview ? 
getbuffer(ibuf->userdata, view_id) : ibuf;
 
+                       /* TODO (dfelinto)
+                        * In some cases we get NULL ibufs, it needs 
investigation, meanwhile prevent crash
+                        * Multiview Render + Image Editor + OpenEXR + 
Multi-View
+                        */
+                       if (view_ibuf == NULL) {
+                               throw std::runtime_error(std::string("Missing 
data to write to ") + name);
+                       }
+
                        /* last scanline, stride negative */
                        rect[0] = view_ibuf->rect_float + channels * (height - 
1) * width;
                        rect[1] = (channels >= 2) ? rect[0] + 1 : rect[0];

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to