summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-05-31 02:07:07 +0000
committerMichael Zucci <zucchi@src.gnome.org>2000-05-31 02:07:07 +0000
commit85e7a89b132cf3bb299c876fc340ab0ce8fbd7d3 (patch)
tree5062f4b8a5d65a6b979a40e46e8bcf34477ba6c9
parent379da28de806edb66ce09fbfd55d1f1e373dfe74 (diff)
downloadgdk-pixbuf-85e7a89b132cf3bb299c876fc340ab0ce8fbd7d3.tar.gz
Initialise the error handler exit routine to our own. Note this means thatnautilus_ms_may_31
2000-05-30 Not Zed <NotZed@HelixCode.com> * gdk-pixbuf/io-jpeg.c (gdk_pixbuf__jpeg_image_begin_load): Initialise the error handler exit routine to our own. Note this means that every function that accesses the jpeg lib on this object MUST do a setjmp. (gdk_pixbuf__jpeg_image_stop_load): setjmp before accessing jpeg lib for handling fatal error. (gdk_pixbuf__jpeg_image_load_increment): And here too. So now your applications dont quit if there's a jpeg error!
-rw-r--r--gdk-pixbuf/ChangeLog11
-rw-r--r--gdk-pixbuf/io-jpeg.c18
2 files changed, 26 insertions, 3 deletions
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog
index 956c25ee7..c5d220249 100644
--- a/gdk-pixbuf/ChangeLog
+++ b/gdk-pixbuf/ChangeLog
@@ -1,3 +1,14 @@
+2000-05-30 Not Zed <NotZed@HelixCode.com>
+
+ * gdk-pixbuf/io-jpeg.c (gdk_pixbuf__jpeg_image_begin_load):
+ Initialise the error handler exit routine to our own. Note this
+ means that every function that accesses the jpeg lib on this
+ object MUST do a setjmp.
+ (gdk_pixbuf__jpeg_image_stop_load): setjmp before accessing jpeg
+ lib for handling fatal error.
+ (gdk_pixbuf__jpeg_image_load_increment): And here too. So now
+ your applications dont quit if there's a jpeg error!
+
2000-05-30 Federico Mena Quintero <federico@helixcode.com>
* gdk-pixbuf.spec.in: Include all the loader libraries. Patch
diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c
index 0a2126925..ed3ee2ac8 100644
--- a/gdk-pixbuf/io-jpeg.c
+++ b/gdk-pixbuf/io-jpeg.c
@@ -108,7 +108,9 @@ fatal_error_handler (j_common_ptr cinfo)
errmgr = (struct error_handler_data *) cinfo->err;
cinfo->err->output_message (cinfo);
siglongjmp (errmgr->setjmp_buffer, 1);
- return;
+
+ /* incase the jmp buf isn't initted? */
+ exit(1);
}
/* Destroy notification function for the pixbuf */
@@ -300,6 +302,7 @@ gdk_pixbuf__jpeg_image_begin_load (ModulePreparedNotifyFunc prepared_func,
src = (my_src_ptr) context->cinfo.src;
context->cinfo.err = jpeg_std_error (&context->jerr.pub);
+ context->jerr.pub.error_exit = fatal_error_handler;
src = (my_src_ptr) context->cinfo.src;
src->pub.init_source = init_source;
@@ -328,8 +331,13 @@ gdk_pixbuf__jpeg_image_stop_load (gpointer data)
if (context->pixbuf)
gdk_pixbuf_unref (context->pixbuf);
- jpeg_finish_decompress(&context->cinfo);
- jpeg_destroy_decompress(&context->cinfo);
+ /* if we have an error? */
+ if (sigsetjmp (context->jerr.setjmp_buffer, 1)) {
+ jpeg_destroy_decompress (&context->cinfo);
+ } else {
+ jpeg_finish_decompress(&context->cinfo);
+ jpeg_destroy_decompress(&context->cinfo);
+ }
if (context->cinfo.src) {
my_src_ptr src = (my_src_ptr) context->cinfo.src;
@@ -373,6 +381,10 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data, guchar *buf, guint size)
* have a grasp of what the flow needs to be!
*/
+ /* check for fatal error */
+ if (sigsetjmp (context->jerr.setjmp_buffer, 1)) {
+ return FALSE;
+ }
/* skip over data if requested, handle unsigned int sizes cleanly */
/* only can happen if we've already called jpeg_get_header once */