Merge pull request #415 from OpenBoard-org/dev-qt5.1x-pdf_optimize_zoom_only

Made the pdf processing thread be terminated on exit after 3s.
preferencesAboutTextFull
kaamui 4 years ago committed by GitHub
commit 6fd3f8ec5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/pdf/XPDFRenderer.cpp
  2. 5
      src/pdf/XPDFRenderer.h

@ -106,7 +106,13 @@ XPDFRenderer::~XPDFRenderer()
{
disconnect(&m_cacheThread, SIGNAL(finished()), this, SLOT(OnThreadFinished()));
m_cacheThread.cancelPending();
m_cacheThread.wait(); // Would crash if data deleted during processing.
m_cacheThread.wait(XPDFThreadMaxTimeoutOnExit::timeout_ms);
if (m_cacheThread.isRunning())
{
// Kill the thread, which might still run for minutes if the user choose a heavy pdf highly zoomed.
// Since there is no data written, but only processing, this is safe on a modern OS.
m_cacheThread.terminate();
}
for(int i = 0; i < m_pdfZoomCache.size(); i++)
{

@ -67,6 +67,11 @@ namespace XPDFRendererZoomFactor
const double mode4_zoomFactorIterations = 7;
}
namespace XPDFThreadMaxTimeoutOnExit
{
const double timeout_ms = 3000;
}
class XPDFRenderer : public PDFRenderer
{
Q_OBJECT

Loading…
Cancel
Save