backport r1047671 okular/trunk/KDE/kdegraphics/okular/core/document.cpp:

empty the pixmaps queue stack before doing the loop waiting for executing pixmap
requests to empty, otherwise a single shot timed call to sendGeneratorRequest
can kick us in the back cause bad things to happen, ranging from crashes to the
app waiting forever in the loop
Patch provided by pino and tested by me
BUG: 212066

svn path=/branches/KDE/4.3/kdegraphics/okular/; revision=1047675
remotes/origin/KDE/4.3
Albert Astals Cid 17 years ago
parent f497ef761d
commit 3014c19f5b
  1. 17
      core/document.cpp

@ -1736,6 +1736,15 @@ void Document::closeDocument()
delete d->m_scripter;
d->m_scripter = 0;
// remove requests left in queue
d->m_pixmapRequestsMutex.lock();
QLinkedList< PixmapRequest * >::const_iterator sIt = d->m_pixmapRequestsStack.constBegin();
QLinkedList< PixmapRequest * >::const_iterator sEnd = d->m_pixmapRequestsStack.constEnd();
for ( ; sIt != sEnd; ++sIt )
delete *sIt;
d->m_pixmapRequestsStack.clear();
d->m_pixmapRequestsMutex.unlock();
QEventLoop loop;
bool startEventLoop = false;
@ -1805,14 +1814,6 @@ void Document::closeDocument()
d->m_fontsCached = false;
d->m_fontsCache.clear();
d->m_rotation = Rotation0;
// remove requests left in queue
d->m_pixmapRequestsMutex.lock();
QLinkedList< PixmapRequest * >::const_iterator sIt = d->m_pixmapRequestsStack.constBegin();
QLinkedList< PixmapRequest * >::const_iterator sEnd = d->m_pixmapRequestsStack.constEnd();
for ( ; sIt != sEnd; ++sIt )
delete *sIt;
d->m_pixmapRequestsStack.clear();
d->m_pixmapRequestsMutex.unlock();
// send an empty list to observers (to free their data)
foreachObserver( notifySetup( QVector< Page * >(), DocumentObserver::DocumentChanged ) );

Loading…
Cancel
Save