[gimp] file-jpeg: Make cinfo struct static so asynchronous saves don't crash



commit b072e7583351171bae8297b8cd191ccd958bc6aa
Author: Mukund Sivaraman <muks banu com>
Date:   Sat Oct 23 17:23:22 2010 +0530

    file-jpeg: Make cinfo struct static so asynchronous saves don't crash
    
    The plug-in already makes a copy of the cinfo struct for asynchronous
    save, but it seems that somewhere inside cinfo, a pointer points to
    another region in this struct. So, everything is copied as-is, and
    the pointer ends up pointing to somewhere in the save_image() stack
    which is gone when that function returns.

 plug-ins/file-jpeg/jpeg-save.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/file-jpeg/jpeg-save.c b/plug-ins/file-jpeg/jpeg-save.c
index ce9535a..d6dd96c 100644
--- a/plug-ins/file-jpeg/jpeg-save.c
+++ b/plug-ins/file-jpeg/jpeg-save.c
@@ -265,8 +265,8 @@ save_image (const gchar  *filename,
   GimpDrawable  *drawable;
   GimpImageType  drawable_type;
   GimpParasite  *parasite;
-  struct jpeg_compress_struct cinfo;
-  struct my_error_mgr         jerr;
+  static struct jpeg_compress_struct cinfo;
+  static struct my_error_mgr         jerr;
   JpegSubsampling             subsampling;
   FILE     * volatile outfile;
   guchar   *temp, *t;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]