diff --git a/ui/presentationwidget.cpp b/ui/presentationwidget.cpp index 6bee4a210..9c2f215cd 100644 --- a/ui/presentationwidget.cpp +++ b/ui/presentationwidget.cpp @@ -589,32 +589,30 @@ void PresentationWidget::changePage( int newPage ) // operation will take long: set busy cursor QApplication::setOverrideCursor( KCursor::workingCursor() ); // request the pixmap - QLinkedList< Okular::PixmapRequest * > request; - request.push_back( new Okular::PixmapRequest( PRESENTATION_ID, m_frameIndex, pixW, pixH, PRESENTATION_PRIO, false ) ); - m_document->requestPixmaps( request ); + QLinkedList< Okular::PixmapRequest * > requests; + requests.push_back( new Okular::PixmapRequest( PRESENTATION_ID, m_frameIndex, pixW, pixH, PRESENTATION_PRIO, false ) ); // restore cursor QApplication::restoreOverrideCursor(); // ask for next and previous page if not in low memory usage setting if (Okular::Settings::memoryLevel() != Okular::Settings::EnumMemoryLevel::Low && Okular::Settings::enableThreading()) { - QLinkedList< Okular::PixmapRequest * > asyncRequests; - if (newPage + 1 < (int)m_document->pages()) - { - PresentationFrame *nextFrame = m_frames[ newPage + 1 ]; - pixW = nextFrame->geometry.width(); - pixH = nextFrame->geometry.height(); - if ( !nextFrame->page->hasPixmap( PRESENTATION_ID, pixW, pixH ) ) - asyncRequests.push_back( new Okular::PixmapRequest( PRESENTATION_ID, newPage + 1, pixW, pixH, PRESENTATION_PRELOAD_PRIO, true ) ); - } if (newPage - 1 >= 0) { PresentationFrame *prevFrame = m_frames[ newPage - 1 ]; pixW = prevFrame->geometry.width(); pixH = prevFrame->geometry.height(); if ( !prevFrame->page->hasPixmap( PRESENTATION_ID, pixW, pixH ) ) - asyncRequests.push_back( new Okular::PixmapRequest( PRESENTATION_ID, newPage - 1, pixW, pixH, PRESENTATION_PRELOAD_PRIO, true ) ); + requests.push_back( new Okular::PixmapRequest( PRESENTATION_ID, newPage - 1, pixW, pixH, PRESENTATION_PRELOAD_PRIO, true ) ); + } + if (newPage + 1 < (int)m_document->pages()) + { + PresentationFrame *nextFrame = m_frames[ newPage + 1 ]; + pixW = nextFrame->geometry.width(); + pixH = nextFrame->geometry.height(); + if ( !nextFrame->page->hasPixmap( PRESENTATION_ID, pixW, pixH ) ) + requests.push_back( new Okular::PixmapRequest( PRESENTATION_ID, newPage + 1, pixW, pixH, PRESENTATION_PRELOAD_PRIO, true ) ); } - if (!asyncRequests.isEmpty()) m_document->requestPixmaps( asyncRequests ); } + m_document->requestPixmaps( requests ); } else {