________________________________________________________________________
r420385 | aacid | 2005_06_01 00:46:24 |0200 (Wed, 01 Jun 2005) | 2 lines

used linkedlist instead of list and now it does not crashes on viewport scrolling

________________________________________________________________________
Index: core/document.cpp
===================================================================
--- core/document.cpp	(revision 420384)
+++ core/document.cpp	(working copy)
@@ -58,14 +58,14 @@
         QStringList kimgioMimes;
 
         // viewport stuff
-        QList< DocumentViewport > viewportHistory;
-        QList< DocumentViewport >::iterator viewportIterator;
+        QLinkedList< DocumentViewport > viewportHistory;
+        QLinkedList< DocumentViewport >::iterator viewportIterator;
         DocumentViewport nextDocumentViewport; // see KPDFLink::Goto for an explanation
 
         // observers / requests / allocator stuff
         QMap< int, DocumentObserver * > observers;
-        QList< PixmapRequest * > pixmapRequestsStack;
-        QList< AllocatedPixmap * > allocatedPixmapsFifo;
+        QLinkedList< PixmapRequest * > pixmapRequestsStack;
+        QLinkedList< AllocatedPixmap * > allocatedPixmapsFifo;
         int allocatedPixmapsTotalMemory;
 
         // timers (memory checking / info saver)
@@ -88,7 +88,7 @@
     // store search properties
     int continueOnPage;
     NormalizedRect continueOnMatch;
-    QList< int > highlightedPages;
+    QLinkedList< int > highlightedPages;
 
     // fields related to previous searches (used for 'continueSearch')
     QString cachedString;
@@ -245,8 +245,8 @@
     d->url = KURL();
 
     // remove requests left in queue
-    QList< PixmapRequest * >::iterator sIt = d->pixmapRequestsStack.begin();
-    QList< PixmapRequest * >::iterator sEnd = d->pixmapRequestsStack.end();
+    QLinkedList< PixmapRequest * >::iterator sIt = d->pixmapRequestsStack.begin();
+    QLinkedList< PixmapRequest * >::iterator sEnd = d->pixmapRequestsStack.end();
     for ( ; sIt != sEnd; ++sIt )
         delete *sIt;
     d->pixmapRequestsStack.clear();
@@ -262,8 +262,8 @@
     pages_vector.clear();
 
     // clear 'memory allocation' descriptors
-    QList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin();
-    QList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end();
+    QLinkedList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin();
+    QLinkedList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end();
     for ( ; aIt != aEnd; ++aIt )
         delete *aIt;
     d->allocatedPixmapsFifo.clear();
@@ -308,8 +308,8 @@
             (*it)->deletePixmap( observerId );
 
         // [MEM] free observer's allocation descriptors
-        QList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin();
-        QList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end();
+        QLinkedList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin();
+        QLinkedList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end();
         while ( aIt != aEnd )
         {
             AllocatedPixmap * p = *aIt;
@@ -338,8 +338,8 @@
             (*it)->deletePixmapsAndRects();
 
         // [MEM] remove allocation descriptors
-        QList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin();
-        QList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end();
+        QLinkedList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin();
+        QLinkedList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end();
         for ( ; aIt != aEnd; ++aIt )
             delete *aIt;
         d->allocatedPixmapsFifo.clear();
@@ -445,7 +445,7 @@
 
     // 1. [CLEAN STACK] remove previous requests of requesterID
     int requesterID = requests.first()->id;
-    QList< PixmapRequest * >::iterator sIt = d->pixmapRequestsStack.begin(), sEnd = d->pixmapRequestsStack.end();
+    QLinkedList< PixmapRequest * >::iterator sIt = d->pixmapRequestsStack.begin(), sEnd = d->pixmapRequestsStack.end();
     while ( sIt != sEnd )
     {
         if ( (*sIt)->id == requesterID )
@@ -573,9 +573,9 @@
     if ( d->allocatedPixmapsFifo.count() > 1 )
     {
         const int page = viewport.pageNumber;
-        QList< AllocatedPixmap * > viewportPixmaps;
-        QList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin();
-        QList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end();
+        QLinkedList< AllocatedPixmap * > viewportPixmaps;
+        QLinkedList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin();
+        QLinkedList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end();
         while ( aIt != aEnd )
         {
             if ( (*aIt)->page == page )
@@ -605,7 +605,7 @@
 void KPDFDocument::setNextViewport()
 // restore next viewport from the history
 {
-    QList< DocumentViewport >::iterator nextIterator = d->viewportIterator;
+    QLinkedList< DocumentViewport >::iterator nextIterator = d->viewportIterator;
     ++nextIterator;
     if ( nextIterator != d->viewportHistory.end() )
     {
@@ -643,11 +643,11 @@
 
     // global data for search
     bool foundAMatch = false;
-    QList< int > pagesToNotify;
+    QLinkedList< int > pagesToNotify;
 
     // remove highlights from pages and queue them for notifying changes
     pagesToNotify += s->highlightedPages;
-    QList< int >::iterator it = s->highlightedPages.begin(), end = s->highlightedPages.end();
+    QLinkedList< int >::iterator it = s->highlightedPages.begin(), end = s->highlightedPages.end();
     for ( ; it != end; ++it )
         pages_vector[ *it ]->deleteHighlights( searchID );
     s->highlightedPages.clear();
@@ -859,7 +859,7 @@
     }
 
     // notify observers about highlights changes
-    QList< int >::iterator nIt = pagesToNotify.begin(), nEnd = pagesToNotify.end();
+    QLinkedList< int >::iterator nIt = pagesToNotify.begin(), nEnd = pagesToNotify.end();
     for ( ; nIt != nEnd; ++nIt )
         foreachObserver( notifyPageChanged( *nIt, DocumentObserver::Highlights ) );
 
@@ -890,7 +890,7 @@
     RunningSearch * s = d->searches[ searchID ];
 
     // unhighlight pages and inform observers about that
-    QList< int >::iterator it = s->highlightedPages.begin(), end = s->highlightedPages.end();
+    QLinkedList< int >::iterator it = s->highlightedPages.begin(), end = s->highlightedPages.end();
     for ( ; it != end; ++it )
     {
         int pageNumber = *it;
@@ -1082,8 +1082,8 @@
 #endif
 
     // [MEM] 1.1 find and remove a previous entry for the same page and id
-    QList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin();
-    QList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end();
+    QLinkedList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin();
+    QLinkedList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end();
     for ( ; aIt != aEnd; ++aIt )
         if ( (*aIt)->page == req->pageNumber && (*aIt)->id == req->id )
         {
@@ -1168,8 +1168,8 @@
     {
         // [MEM] free memory starting from older pixmaps
         int pagesFreed = 0;
-        QList< AllocatedPixmap * >::iterator pIt = d->allocatedPixmapsFifo.begin();
-        QList< AllocatedPixmap * >::iterator pEnd = d->allocatedPixmapsFifo.end();
+        QLinkedList< AllocatedPixmap * >::iterator pIt = d->allocatedPixmapsFifo.begin();
+        QLinkedList< AllocatedPixmap * >::iterator pEnd = d->allocatedPixmapsFifo.end();
         while ( (pIt != pEnd) && (memoryToFree > 0) )
         {
             AllocatedPixmap * p = *pIt;
@@ -1400,7 +1400,7 @@
         root.appendChild( generalInfo );
 
         // <general info><history> ... </history> saves history up to 10 viewports
-        QList< DocumentViewport >::iterator backIterator = d->viewportIterator;
+        QLinkedList< DocumentViewport >::iterator backIterator = d->viewportIterator;
         if ( backIterator != d->viewportHistory.end() )
         {
             // go back up to 10 steps from the current viewportIterator
@@ -1413,7 +1413,7 @@
             generalInfo.appendChild( historyNode );
 
             // add old[backIterator] and present[viewportIterator] items
-            QList< DocumentViewport >::iterator endIt = d->viewportIterator;
+            QLinkedList< DocumentViewport >::iterator endIt = d->viewportIterator;
             ++endIt;
             while ( backIterator != endIt )
             {