Forwardport SVN commit 665684 by pino:

When getting the result of a pixmap request for an observer that went away in the meanwhile, don't create a memory entry for the pixmap, as we assume the allocated pixmaps fifo holds only descriptors for valid observers.

(fixed KPDF #143951)

svn path=/trunk/KDE/kdegraphics/okular/; revision=665685
This commit is contained in:
Pino Toscano 2007-05-17 16:52:44 +00:00
parent 3bd28d1fbb
commit c4ea50c99b

View file

@ -2268,16 +2268,22 @@ void Document::requestDone( PixmapRequest * req )
break;
}
// [MEM] 1.2 append memory allocation descriptor to the FIFO
int memoryBytes = 4 * req->width() * req->height();
AllocatedPixmap * memoryPage = new AllocatedPixmap( req->id(), req->pageNumber(), memoryBytes );
d->m_allocatedPixmapsFifo.append( memoryPage );
d->m_allocatedPixmapsTotalMemory += memoryBytes;
// 2. notify an observer that its pixmap changed
QMap< int, DocumentObserver * >::const_iterator itObserver = d->m_observers.constFind( req->id() );
if ( itObserver != d->m_observers.constEnd() )
{
// [MEM] 1.2 append memory allocation descriptor to the FIFO
int memoryBytes = 4 * req->width() * req->height();
AllocatedPixmap * memoryPage = new AllocatedPixmap( req->id(), req->pageNumber(), memoryBytes );
d->m_allocatedPixmapsFifo.append( memoryPage );
d->m_allocatedPixmapsTotalMemory += memoryBytes;
// 2. notify an observer that its pixmap changed
itObserver.value()->notifyPageChanged( req->pageNumber(), DocumentObserver::Pixmap );
}
#ifndef NDEBUG
else
kWarning() << "Receiving a done request for the defunct observer " << req->id() << endl;
#endif
// 3. delete request
delete req;