From 1b49db09d5ffedb03dedabac514b994a4d4b5961 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Tue, 9 Jan 2007 23:37:26 +0000 Subject: [PATCH] be sure to delete the old pixmap before setting a new one svn path=/trunk/playground/graphics/okular/; revision=621863 --- core/page.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/core/page.cpp b/core/page.cpp index 51208010e..ab6b9d30e 100644 --- a/core/page.cpp +++ b/core/page.cpp @@ -364,12 +364,17 @@ const Link * Page::pageAction( PageAction action ) const void Page::setPixmap( int id, QPixmap *pixmap ) { if ( d->m_rotation == Rotation0 ) { - PixmapObject object; - - object.m_pixmap = pixmap; - object.m_rotation = d->m_rotation; - - m_pixmaps[ id ] = object; + QMap< int, PixmapObject >::iterator it = m_pixmaps.find( id ); + if ( it != m_pixmaps.end() ) + { + delete it.value().m_pixmap; + } + else + { + it = m_pixmaps.insert( id, PixmapObject() ); + } + it.value().m_pixmap = pixmap; + it.value().m_rotation = d->m_rotation; } else { RotationJob *job = new RotationJob( pixmap->toImage(), Rotation0, d->m_rotation, id ); connect( job, SIGNAL( finished() ), this, SLOT( imageRotationDone() ) );