Commit 83374b97 authored by Albert Astals Cid's avatar Albert Astals Cid Committed by Albert Astals Cid

PDF: Fix potential crash

Probably doesn't happen often but pdfdoc usage also needs to be protected by the mutex
parent 42d47101
......@@ -1108,24 +1108,22 @@ Okular::TextPage* PDFGenerator::textPage( Okular::Page *page )
// build a TextList...
QList<Poppler::TextBox*> textList;
double pageWidth, pageHeight;
userMutex()->lock();
Poppler::Page *pp = pdfdoc->page( page->number() );
if (pp)
{
userMutex()->lock();
textList = pp->textList();
userMutex()->unlock();
QSizeF s = pp->pageSizeF();
const QSizeF s = pp->pageSizeF();
pageWidth = s.width();
pageHeight = s.height();
delete pp;
}
else
{
pageWidth = defaultPageWidth;
pageHeight = defaultPageHeight;
}
delete pp;
userMutex()->unlock();
Okular::TextPage *tp = abstractTextPage(textList, pageHeight, pageWidth, (Poppler::Page::Rotation)page->orientation());
qDeleteAll(textList);
......
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