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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-08-31 03:08:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-08-31 03:08:38 +0400
commitc58a0c5eb814db1be08c0e8a4353ad5606a23d30 (patch)
tree8771cf76565345b4e56ab473be58ccd7e447a0a1 /source/blender/imbuf
parent5ac81bfe9c523c2ea0dcbc55bc8454c2e12239e0 (diff)
catch exception and report an error when failing to write exr files - was crashing with debug builds.
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp15
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_multi.h4
-rw-r--r--source/blender/imbuf/intern/writeimage.c1
3 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 7b528ed9624..88f6508d356 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -487,7 +487,7 @@ void IMB_exr_add_channel(void *handle, const char *layname, const char *passname
}
/* only used for writing temp. render results (not image files) */
-void IMB_exr_begin_write(void *handle, const char *filename, int width, int height, int compress)
+int IMB_exr_begin_write(void *handle, const char *filename, int width, int height, int compress)
{
ExrHandle *data= (ExrHandle *)handle;
Header header (width, height);
@@ -504,8 +504,17 @@ void IMB_exr_begin_write(void *handle, const char *filename, int width, int heig
/* header.lineOrder() = DECREASING_Y; this crashes in windows for file read! */
header.insert ("BlenderMultiChannel", StringAttribute ("Blender V2.55.1 and newer"));
-
- data->ofile = new OutputFile(filename, header);
+
+ /* avoid crash/abort when we dont have permission to write here */
+ try {
+ data->ofile = new OutputFile(filename, header);
+ }
+ catch (const std::exception &exc) {
+ std::cerr << "IMB_exr_begin_write: ERROR: " << exc.what() << std::endl;
+ data->ofile = NULL;
+ }
+
+ return (data->ofile != NULL);
}
void IMB_exrtile_begin_write(void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley)
diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h
index 3d95bb7c306..58c5e0f2a3e 100644
--- a/source/blender/imbuf/intern/openexr/openexr_multi.h
+++ b/source/blender/imbuf/intern/openexr/openexr_multi.h
@@ -50,7 +50,7 @@ void * IMB_exr_get_handle (void);
void IMB_exr_add_channel (void *handle, const char *layname, const char *passname, int xstride, int ystride, float *rect);
int IMB_exr_begin_read (void *handle, const char *filename, int *width, int *height);
-void IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress);
+int IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress);
void IMB_exrtile_begin_write (void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley);
void IMB_exr_set_channel (void *handle, const char *layname, const char *passname, int xstride, int ystride, float *rect);
@@ -75,7 +75,7 @@ void * IMB_exr_get_handle (void) {return NULL;}
void IMB_exr_add_channel (void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; }
int IMB_exr_begin_read (void *handle, const char *filename, int *width, int *height) { (void)handle; (void)filename; (void)width; (void)height; return 0;}
-void IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; }
+int IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; return 0;}
void IMB_exrtile_begin_write (void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley) { (void)handle; (void)filename; (void)mipmap; (void)width; (void)height; (void)tilex; (void)tiley; }
void IMB_exr_set_channel (void *handle, char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; }
diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c
index cd660e11f26..b933e6d93ee 100644
--- a/source/blender/imbuf/intern/writeimage.c
+++ b/source/blender/imbuf/intern/writeimage.c
@@ -55,7 +55,6 @@ short IMB_saveiff(struct ImBuf *ibuf, const char *name, int flags)
if(ibuf->rect==NULL && ibuf->rect_float)
IMB_rect_from_float(ibuf);
}
- /* TODO. have const char for image write funcs */
return type->save(ibuf, name, flags);
}
}