Commit ad1cc07c authored by Enrico Ros's avatar Enrico Ros

This is the correct order of deleting things now that a generator thread

may be running.

svn path=/trunk/kdegraphics/kpdf/; revision=375082
parent ca3f3b8e
......@@ -142,14 +142,18 @@ void KPDFDocument::closeDocument()
// stop memory check timer
d->memCheckTimer->stop();
// delete contents generator
delete generator;
generator = 0;
// send an empty list to observers (to free their data)
foreachObserver( pageSetup( QValueVector< KPDFPage * >(), true ) );
// delete pages and clear 'pages_vector' container
for ( uint i = 0; i < pages_vector.count() ; i++ )
delete pages_vector[i];
pages_vector.clear();
// send an empty list to observers (to free their data)
foreachObserver( pageSetup( pages_vector, true ) );
// clear memory management data
QMap< int, ObserverData * >::iterator oIt = d->observers.begin(), oEnd = d->observers.end();
for ( ; oIt != oEnd ; ++oIt )
......@@ -159,10 +163,6 @@ void KPDFDocument::closeDocument()
observerData->totalMemory = 0;
}
// delete contents generator
delete generator;
generator = 0;
// reset internal variables
d->currentPage = -1;
d->searchPage = -1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment