Bug 102239 - gwenview-1.2.0_pre4 quits randomly when browsing images forward and backward in full screen mode
Summary: gwenview-1.2.0_pre4 quits randomly when browsing images forward and backward ...
Status: RESOLVED FIXED
Alias: None
Product: gwenview
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: Gwenview Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-23 03:39 UTC by polarbear
Modified: 2012-10-19 13:26 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description polarbear 2005-03-23 03:39:46 UTC
Version:           1.2.0_pre4 (using KDE KDE 3.4.0)
Installed from:    Gentoo Packages
Compiler:          gcc-3.4.3 
OS:                Linux

Gwenview-1.2.0_pre4 quits randomly when browsing images forward and backward using the mouse scroll wheel in full screen mode. It just quit NOT crash (no crash event generated). The konsole output are as follows :-

$ gwenview
QMultiInputContext::changeInputMethod(): index=0, slave=xim
gwenview: ERROR: No data
gwenview: WARNING: [int GVImageUtils::inmem_fill_input_buffer(jpeg_decompress_struct*)]  Image is incomplete
Not a JPEG file: starts with 0xff 0xd9
$

This problem did not exist on earlier versions of gwenview upto gwenview-1.2.0_pre3. To confirm this, I have uninstalled gwenview-1.2.0_pre4 and installed gwenview-1.2.0_pre3 and the problem simply goes away.
Comment 1 Lubos Lunak 2005-03-23 11:59:13 UTC
This has been already fixed in CVS.
Comment 2 Tom Malfrere 2005-05-23 00:35:02 UTC
I have the same problem on 1.2 release version... is it resolved then???

gwenview: WARNING: [int GVImageUtils::inmem_fill_input_buffer(jpeg_decompress_struct*)]  Image is incomplete
Not a JPEG file: starts with 0xff 0xd9

Comment 3 Aurelien Gateau 2005-06-20 22:46:57 UTC
SVN commit 427490 by gateau:

- Reworked the JPEG error manager from jpegformattype a bit
- Moved it to imageutils/jpegerrormanager.h
- Use it in imageutils/jpegcontent.cpp
BUG: 107737
CCBUG: 102239


 M  +3 -23     gvcore/jpegformattype.cpp  
 M  +2 -1      imageutils/Makefile.am  
 M  +22 -8     imageutils/jpegcontent.cpp  
 A             imageutils/jpegerrormanager.h   [License: GPL (v2+)]


--- trunk/extragear/graphics/gwenview/gvcore/jpegformattype.cpp #427489:427490
@@ -44,6 +44,7 @@
 
 // Local
 #include "jpegformattype.h"
+#include "imageutils/jpegerrormanager.h"
 
 namespace Gwenview {
 
@@ -60,26 +61,6 @@
 
 //-----------------------------------------------------------------------------
 //
-// JPEGErrorManager
-// (Does not follow HACKING naming recommandation to be consistent with
-// jpeg_error_mgr naming)
-//
-//-----------------------------------------------------------------------------
-struct JPEGErrorManager : public jpeg_error_mgr {
-	jmp_buf jmp_buffer;
-
-	static void errorExitCallBack (j_common_ptr cinfo) {
-		JPEGErrorManager* myerr = (JPEGErrorManager*) cinfo->err;
-		char buffer[JMSG_LENGTH_MAX];
-		(*cinfo->err->format_message)(cinfo, buffer);
-		kdWarning() << buffer << endl;
-		longjmp(myerr->jmp_buffer, 1);
-	}
-};
-
-
-//-----------------------------------------------------------------------------
-//
 // JPEGSourceManager
 // (Does not follow HACKING file recommandation to be consistent with
 // jpeg_source_mgr naming)
@@ -211,15 +192,14 @@
 
 	// structs for the jpeglib
 	jpeg_decompress_struct mDecompress;
-	JPEGErrorManager mErrorManager;
+	ImageUtils::JPEGErrorManager mErrorManager;
 	JPEGSourceManager mSourceManager;
 };
 
 
 JPEGFormat::JPEGFormat() {
 	memset(&mDecompress, 0, sizeof(mDecompress));
-	mDecompress.err = jpeg_std_error(&mErrorManager);
-	mErrorManager.error_exit=JPEGErrorManager::errorExitCallBack;
+	mDecompress.err = &mErrorManager;
 	jpeg_create_decompress(&mDecompress);
 	mDecompress.src = &mSourceManager;
 	mState = INIT;
--- trunk/extragear/graphics/gwenview/imageutils/Makefile.am #427489:427490
@@ -28,7 +28,8 @@
 	jpegcontent.h \
 	jinclude.h \
 	jpegint.h \
-	transupp.h
+	transupp.h \
+	jpegerrormanager.h
 
 METASOURCES = AUTO
 
--- trunk/extragear/graphics/gwenview/imageutils/jpegcontent.cpp #427489:427490
@@ -45,6 +45,7 @@
 #include "imageutils/imageutils.h"
 #include "imageutils/jpegcontent.h"
 #include "imageutils/jpeg-data.h"
+#include "imageutils/jpegerrormanager.h"
 
 namespace ImageUtils {
 
@@ -186,11 +187,15 @@
 		jpeg_saved_marker_ptr mark;
 		
 		// Init JPEG structs 
-		struct jpeg_error_mgr jsrcerr;
+		JPEGErrorManager errorManager;
 
-		// Initialize the JPEG decompression object with default error handling
-		srcinfo.err = jpeg_std_error(&jsrcerr);
+		// Initialize the JPEG decompression object
+		srcinfo.err = &errorManager;
 		jpeg_create_decompress(&srcinfo);
+		if (setjmp(errorManager.jmp_buffer)) {
+			kdError() << k_funcinfo << "libjpeg fatal error\n";
+			return false;
+		}
 
 		// Specify data source for decompression
 		setupInmemSource(&srcinfo);
@@ -370,17 +375,26 @@
 	// Init JPEG structs 
 	struct jpeg_decompress_struct srcinfo;
 	struct jpeg_compress_struct dstinfo;
-	struct jpeg_error_mgr jsrcerr, jdsterr;
 	jvirt_barray_ptr * src_coef_arrays;
 	jvirt_barray_ptr * dst_coef_arrays;
 
-	// Initialize the JPEG decompression object with default error handling
-	srcinfo.err = jpeg_std_error(&jsrcerr);
+	// Initialize the JPEG decompression object
+	JPEGErrorManager srcErrorManager;
+	srcinfo.err = &srcErrorManager;
 	jpeg_create_decompress(&srcinfo);
+	if (setjmp(srcErrorManager.jmp_buffer)) {
+		kdError() << k_funcinfo << "libjpeg error in src\n";
+		return;
+	}
 
-	// Initialize the JPEG compression object with default error handling
-	dstinfo.err = jpeg_std_error(&jdsterr);
+	// Initialize the JPEG compression object
+	JPEGErrorManager dstErrorManager;
+	dstinfo.err = &dstErrorManager;
 	jpeg_create_compress(&dstinfo);
+	if (setjmp(dstErrorManager.jmp_buffer)) {
+		kdError() << k_funcinfo << "libjpeg error in dst\n";
+		return;
+	}
 
 	// Specify data source for decompression
 	d->setupInmemSource(&srcinfo);