Commit 5e2d190e authored by Luigi Toscano's avatar Luigi Toscano

Guard drawText() when X-bitmap fonts are used

If the fonts are mapped for some reason to X bitmap fonts,
the call to drawText() in the non-GUI thread will produce a crash.
Ensure that the rendering of the text is performed only if
the threaded font rendering is available - a rare event nowadays,
but still possible.

CCBUG: 248852
parent d888b204
......@@ -20,6 +20,7 @@
#include <kmimetype.h>
#include <QFile>
#include <QFontDatabase>
#include <QImage>
#include <QPainter>
......@@ -421,11 +422,17 @@ void dviRenderer::epsf_special(const QString& cp)
QFont f = foreGroundPainter->font();
f.setPointSize(8);
foreGroundPainter->setFont(f);
if (QFile::exists(EPSfilename))
foreGroundPainter->drawText (bbox, (int)(Qt::AlignCenter), EPSfilename);
else
foreGroundPainter->drawText (bbox, (int)(Qt::AlignCenter),
i18n("File not found: \n %1", EPSfilename_orig));
/* if the fonts are mapped for some reason to X bitmap fonts,
the call to drawText() in the non-GUI thread will produce a crash.
Ensure that the rendering of the text is performed only if
the threaded font rendering is available */
if (QFontDatabase::supportsThreadedFontRendering()) {
if (QFile::exists(EPSfilename))
foreGroundPainter->drawText (bbox, (int)(Qt::AlignCenter), EPSfilename);
else
foreGroundPainter->drawText (bbox, (int)(Qt::AlignCenter),
i18n("File not found: \n %1", EPSfilename_orig));
}
foreGroundPainter->restore();
}
......
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