Version: 0.5.3 (using KDE KDE 3.5.3) Installed from: SuSE RPMs OS: Linux kpdf correctly displays a certain file. After clicking on "print preview", kpdf crashes. Other pdf files can be previewed without problems. When started from the command line, it outputs "Improper call to JPEG library in state 205" immediately before crashing.
Created attachment 16818 [details] This file leads to crash on "print preview"
Maybe there is a correspondance to bug #118303.
SVN commit 555943 by aacid: Reset the jpeg structures on reset. BUGS: 129971 Fix will be on KDE 3.5.4 M +18 -7 DCTStream.cc M +2 -0 DCTStream.h --- branches/KDE/3.5/kdegraphics/kpdf/xpdf/xpdf/DCTStream.cc #555942:555943 @@ -54,7 +54,16 @@ DCTStream::DCTStream(Stream *strA): FilterStream(strA) { - + init(); +} + +DCTStream::~DCTStream() { + jpeg_destroy_decompress(&cinfo); + delete str; +} + +void DCTStream::init() +{ jpeg_create_decompress(&cinfo); src.pub.init_source = str_init_source; src.pub.fill_input_buffer = str_fill_input_buffer; @@ -68,18 +77,20 @@ cinfo.src = (jpeg_source_mgr *)&src; cinfo.err = jpeg_std_error(&jerr); x = 0; + row_buffer = NULL; } -DCTStream::~DCTStream() { - jpeg_destroy_decompress(&cinfo); - delete str; -} - void DCTStream::reset() { int row_stride; str->reset(); - + + if (row_buffer) + { + jpeg_destroy_decompress(&cinfo); + init(); + } + // JPEG data has to start with 0xFF 0xD8 // but some pdf like the one on // https://bugs.freedesktop.org/show_bug.cgi?id=3299 --- branches/KDE/3.5/kdegraphics/kpdf/xpdf/xpdf/DCTStream.h #555942:555943 @@ -62,6 +62,8 @@ Stream *getRawStream() { return str; } private: + void init(); + unsigned int x; struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr;