From b2472bef0d87d33aaa8eeec1e8014cda23f77226 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Tue, 30 Jun 2009 17:21:55 +0000 Subject: [PATCH] check that the rotation page notification really refers to a page of a document fixes crash when rotating documents opened in one of more than one okular tabs in konqueror svn path=/trunk/KDE/kdegraphics/okular/; revision=989681 --- core/document.cpp | 6 +++++- core/document.h | 2 +- core/document_p.h | 2 +- core/pagecontroller.cpp | 2 +- core/pagecontroller_p.h | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/core/document.cpp b/core/document.cpp index 3e575a536..4f6b2b05d 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -890,8 +890,12 @@ void DocumentPrivate::sendGeneratorRequest() } } -void DocumentPrivate::rotationFinished( int page ) +void DocumentPrivate::rotationFinished( int page, Okular::Page *okularPage ) { + Okular::Page *wantedPage = m_pagesVector.value( page, 0 ); + if ( !wantedPage || wantedPage != okularPage ) + return; + QMap< int, DocumentObserver * >::const_iterator it = m_observers.constBegin(), end = m_observers.constEnd(); for ( ; it != end ; ++ it ) { (*it)->notifyPageChanged( page, DocumentObserver::Pixmap | DocumentObserver::Annotations ); diff --git a/core/document.h b/core/document.h index c0e5bec19..a699c7c35 100644 --- a/core/document.h +++ b/core/document.h @@ -699,7 +699,7 @@ class OKULAR_EXPORT Document : public QObject Q_PRIVATE_SLOT( d, void saveDocumentInfo() const ) Q_PRIVATE_SLOT( d, void slotTimedMemoryCheck() ) Q_PRIVATE_SLOT( d, void sendGeneratorRequest() ) - Q_PRIVATE_SLOT( d, void rotationFinished( int page ) ) + Q_PRIVATE_SLOT( d, void rotationFinished( int page, Okular::Page *okularPage ) ) Q_PRIVATE_SLOT( d, void fontReadingProgress( int page ) ) Q_PRIVATE_SLOT( d, void fontReadingGotFont( const Okular::FontInfo& font ) ) Q_PRIVATE_SLOT( d, void slotGeneratorConfigChanged( const QString& ) ) diff --git a/core/document_p.h b/core/document_p.h index c05db4106..5c9493a55 100644 --- a/core/document_p.h +++ b/core/document_p.h @@ -118,7 +118,7 @@ class DocumentPrivate void saveDocumentInfo() const; void slotTimedMemoryCheck(); void sendGeneratorRequest(); - void rotationFinished( int page ); + void rotationFinished( int page, Okular::Page *okularPage ); void fontReadingProgress( int page ); void fontReadingGotFont( const Okular::FontInfo& font ); void slotGeneratorConfigChanged( const QString& ); diff --git a/core/pagecontroller.cpp b/core/pagecontroller.cpp index 1a2d477cb..9b4e62264 100644 --- a/core/pagecontroller.cpp +++ b/core/pagecontroller.cpp @@ -52,7 +52,7 @@ void PageController::imageRotationDone(ThreadWeaver::Job *j) { job->page()->imageRotationDone( job ); - emit rotationFinished( job->page()->m_number ); + emit rotationFinished( job->page()->m_number, job->page()->m_page ); } job->deleteLater(); diff --git a/core/pagecontroller_p.h b/core/pagecontroller_p.h index c0530c66d..a4d4df91b 100644 --- a/core/pagecontroller_p.h +++ b/core/pagecontroller_p.h @@ -38,7 +38,7 @@ class PageController : public QObject void addRotationJob( RotationJob *job ); signals: - void rotationFinished( int page ); + void rotationFinished( int page, Okular::Page *okularPage ); private slots: void imageRotationDone(ThreadWeaver::Job*);