Commit c4e612d6 authored by Christophe Devriese's avatar Christophe Devriese

bugfixes, removed a lot of processEvent calls that caused crashes

svn path=/trunk/kdegraphics/kpdf/; revision=242829
parent 100be6fa
This diff is collapsed.
This diff is collapsed.
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <qcursor.h> #include <qcursor.h>
#include <qpainter.h> #include <qpainter.h>
#include <qmutex.h>
#include "PDFDoc.h" #include "PDFDoc.h"
...@@ -103,13 +104,17 @@ namespace KPDF ...@@ -103,13 +104,17 @@ namespace KPDF
void PageWidget::setPage(int page) void PageWidget::setPage(int page)
{ {
if (m_doc) static QMutex mutex;
{
m_currentPage = max(0, min( page, m_doc->getNumPages())); mutex.lock();
} else { if (m_doc)
m_currentPage = 0; {
} m_currentPage = max(0, min( page, m_doc->getNumPages()));
updatePixmap(); } else {
m_currentPage = 0;
}
updatePixmap();
mutex.unlock();
}; };
void PageWidget::updatePixmap() void PageWidget::updatePixmap()
......
...@@ -21,8 +21,8 @@ static void md5(Guchar *msg, int msgLen, Guchar *digest); ...@@ -21,8 +21,8 @@ static void md5(Guchar *msg, int msgLen, Guchar *digest);
static Guchar passwordPad[32] = { static Guchar passwordPad[32] = {
0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41,
0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08, 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08,
0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80,
0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a
}; };
...@@ -125,7 +125,7 @@ GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength, ...@@ -125,7 +125,7 @@ GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength,
permissions, fileID, userPassword, fileKey); permissions, fileID, userPassword, fileKey);
} }
GBool Decrypt::makeFileKey2(int encVersion, int encRevision, int keyLength, GBool Decrypt::makeFileKey2(int /* encVersion */, int encRevision, int keyLength,
GString *ownerKey, GString *userKey, GString *ownerKey, GString *userKey,
int permissions, GString *fileID, int permissions, GString *fileID,
GString *userPassword, Guchar *fileKey) { GString *userPassword, Guchar *fileKey) {
......
...@@ -410,7 +410,7 @@ void SampledFunction::transform(double *in, double *out) { ...@@ -410,7 +410,7 @@ void SampledFunction::transform(double *in, double *out) {
// ExponentialFunction // ExponentialFunction
//------------------------------------------------------------------------ //------------------------------------------------------------------------
ExponentialFunction::ExponentialFunction(Object *funcObj, Dict *dict) { ExponentialFunction::ExponentialFunction(Object * /* funcObj */, Dict *dict) {
Object obj1, obj2; Object obj1, obj2;
GBool hasN; GBool hasN;
int i; int i;
...@@ -536,7 +536,7 @@ void ExponentialFunction::transform(double *in, double *out) { ...@@ -536,7 +536,7 @@ void ExponentialFunction::transform(double *in, double *out) {
// StitchingFunction // StitchingFunction
//------------------------------------------------------------------------ //------------------------------------------------------------------------
StitchingFunction::StitchingFunction(Object *funcObj, Dict *dict) { StitchingFunction::StitchingFunction(Object * /* funcObj */, Dict *dict) {
Object obj1, obj2; Object obj1, obj2;
int i; int i;
......
...@@ -1452,11 +1452,11 @@ int JBIG2Stream::lookChar() { ...@@ -1452,11 +1452,11 @@ int JBIG2Stream::lookChar() {
return EOF; return EOF;
} }
GString *JBIG2Stream::getPSFilter(char *indent) { GString *JBIG2Stream::getPSFilter(char * /* indent */) {
return NULL; return NULL;
} }
GBool JBIG2Stream::isBinary(GBool last) { GBool JBIG2Stream::isBinary(GBool /* last */) {
return str->isBinary(gTrue); return str->isBinary(gTrue);
} }
...@@ -1924,7 +1924,7 @@ void JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length, ...@@ -1924,7 +1924,7 @@ void JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length,
} }
ex = !ex; ex = !ex;
} }
for (i = 0; i < numNewSyms; ++i) { for (i = 0; i < numNewSyms; ++i) {
delete bitmaps[numInputSyms + i]; delete bitmaps[numInputSyms + i];
} }
......
...@@ -137,12 +137,6 @@ public: ...@@ -137,12 +137,6 @@ public:
int width, int height, GfxImageColorMap *colorMap, int width, int height, GfxImageColorMap *colorMap,
int *maskColors, GBool inlineImg); int *maskColors, GBool inlineImg);
#if OPI_SUPPORT
//----- OPI functions
virtual void opiBegin(GfxState *state, Dict *opiDict);
virtual void opiEnd(GfxState *state, Dict *opiDict);
#endif
//----- Type 3 font operators //----- Type 3 font operators
virtual void type3D0(GfxState *state, double wx, double wy) {} virtual void type3D0(GfxState *state, double wx, double wy) {}
virtual void type3D1(GfxState *state, double wx, double wy, virtual void type3D1(GfxState *state, double wx, double wy,
......
...@@ -201,13 +201,18 @@ void PDFDoc::checkHeader() { ...@@ -201,13 +201,18 @@ void PDFDoc::checkHeader() {
void PDFDoc::displayPage(OutputDev *out, int page, double zoom, void PDFDoc::displayPage(OutputDev *out, int page, double zoom,
int rotate, GBool doLinks, int rotate, GBool doLinks,
GBool (*abortCheckCbk)(void *data), GBool (*abortCheckCbk)(void *data),
void *abortCheckCbkData) { void *abortCheckCbkData) {
if ( page < 0 || page >= catalog->getNumPages() ) return; // obviously invalid page
Page *p; Page *p;
if (globalParams->getPrintCommands()) { if (globalParams->getPrintCommands()) {
printf("***** page %d *****\n", page); printf("***** page %d *****\n", page);
} }
p = catalog->getPage(page); p = catalog->getPage(page);
if (doLinks) { if (doLinks) {
if (links) { if (links) {
delete links; delete links;
......
...@@ -252,6 +252,8 @@ void TextPage::beginString(GfxState *state, double x0, double y0) { ...@@ -252,6 +252,8 @@ void TextPage::beginString(GfxState *state, double x0, double y0) {
void TextPage::addChar(GfxState *state, double x, double y, void TextPage::addChar(GfxState *state, double x, double y,
double dx, double dy, Unicode *u, int uLen) { double dx, double dy, Unicode *u, int uLen) {
if (! curStr) return;
double x1, y1, w1, h1, dx2, dy2; double x1, y1, w1, h1, dx2, dy2;
int n, i; int n, i;
...@@ -305,6 +307,8 @@ void TextPage::endString() { ...@@ -305,6 +307,8 @@ void TextPage::endString() {
} }
void TextPage::addString(TextString *str) { void TextPage::addString(TextString *str) {
if (! str) return;
TextString *p1, *p2; TextString *p1, *p2;
// throw away zero-length strings -- they don't have valid xMin/xMax // throw away zero-length strings -- they don't have valid xMin/xMax
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment