diff --git a/core/document.cpp b/core/document.cpp index 1af9b46be..92fb3df20 100644 --- a/core/document.cpp +++ b/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 ) );