mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 18:32:53 +00:00
okular: manage mutexes via QMutexLocker [ci reset]
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
d657dbcd17
commit
62a59fb621
4 changed files with 5 additions and 19 deletions
|
@ -128,10 +128,8 @@ bool DjVuGenerator::doCloseDocument()
|
||||||
|
|
||||||
QImage DjVuGenerator::image( Okular::PixmapRequest *request )
|
QImage DjVuGenerator::image( Okular::PixmapRequest *request )
|
||||||
{
|
{
|
||||||
userMutex()->lock();
|
QMutexLocker locker( userMutex() );
|
||||||
QImage img = m_djvu->image( request->pageNumber(), request->width(), request->height(), request->page()->rotation() );
|
return m_djvu->image( request->pageNumber(), request->width(), request->height(), request->page()->rotation() );
|
||||||
userMutex()->unlock();
|
|
||||||
return img;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Okular::DocumentInfo * DjVuGenerator::generateDocumentInfo()
|
const Okular::DocumentInfo * DjVuGenerator::generateDocumentInfo()
|
||||||
|
@ -190,7 +188,6 @@ const Okular::DocumentSynopsis * DjVuGenerator::generateDocumentSynopsis()
|
||||||
m_docSyn = new Okular::DocumentSynopsis();
|
m_docSyn = new Okular::DocumentSynopsis();
|
||||||
recurseCreateTOC( *m_docSyn, *doc, *m_docSyn, m_djvu );
|
recurseCreateTOC( *m_docSyn, *doc, *m_docSyn, m_djvu );
|
||||||
}
|
}
|
||||||
locker.unlock();
|
|
||||||
|
|
||||||
return m_docSyn;
|
return m_docSyn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,8 +76,6 @@ bool DviGenerator::loadDocument( const QString & fileName, QVector< Okular::Page
|
||||||
//kDebug(DviDebug) << "file:" << fileName;
|
//kDebug(DviDebug) << "file:" << fileName;
|
||||||
KUrl base( fileName );
|
KUrl base( fileName );
|
||||||
|
|
||||||
(void)userMutex();
|
|
||||||
|
|
||||||
m_dviRenderer = new dviRenderer(documentMetaData("TextHinting", QVariant()).toBool());
|
m_dviRenderer = new dviRenderer(documentMetaData("TextHinting", QVariant()).toBool());
|
||||||
connect( m_dviRenderer, SIGNAL( error(QString,int) ), this, SIGNAL( error(QString,int) ) );
|
connect( m_dviRenderer, SIGNAL( error(QString,int) ), this, SIGNAL( error(QString,int) ) );
|
||||||
connect( m_dviRenderer, SIGNAL( warning(QString,int) ), this, SIGNAL( warning(QString,int) ) );
|
connect( m_dviRenderer, SIGNAL( warning(QString,int) ), this, SIGNAL( warning(QString,int) ) );
|
||||||
|
@ -265,8 +263,6 @@ QImage DviGenerator::image( Okular::PixmapRequest *request )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock.unlock();
|
|
||||||
|
|
||||||
delete pageInfo;
|
delete pageInfo;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1041,10 +1041,8 @@ QVariant PDFGenerator::metaData( const QString & key, const QVariant & option )
|
||||||
}
|
}
|
||||||
else if ( key == "DocumentTitle" )
|
else if ( key == "DocumentTitle" )
|
||||||
{
|
{
|
||||||
userMutex()->lock();
|
QMutexLocker ml(userMutex());
|
||||||
QString title = pdfdoc->info( "Title" );
|
return pdfdoc->info( "Title" );
|
||||||
userMutex()->unlock();
|
|
||||||
return title;
|
|
||||||
}
|
}
|
||||||
else if ( key == "OpenTOC" )
|
else if ( key == "OpenTOC" )
|
||||||
{
|
{
|
||||||
|
@ -1692,7 +1690,7 @@ bool PDFGenerator::save( const QString &fileName, SaveOptions options, QString *
|
||||||
if ( options & SaveChanges )
|
if ( options & SaveChanges )
|
||||||
pdfConv->setPDFOptions( pdfConv->pdfOptions() | Poppler::PDFConverter::WithChanges );
|
pdfConv->setPDFOptions( pdfConv->pdfOptions() | Poppler::PDFConverter::WithChanges );
|
||||||
|
|
||||||
QMutexLocker locker( userMutex() );
|
QMutexLocker ml(userMutex());
|
||||||
bool success = pdfConv->convert();
|
bool success = pdfConv->convert();
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2126,13 +2126,8 @@ XpsGenerator::XpsGenerator( QObject *parent, const QVariantList &args )
|
||||||
{
|
{
|
||||||
setFeature( TextExtraction );
|
setFeature( TextExtraction );
|
||||||
setFeature( PrintNative );
|
setFeature( PrintNative );
|
||||||
// activate the threaded rendering iif:
|
|
||||||
// 1) QFontDatabase says so
|
|
||||||
// 2) Qt >= 4.4.0 (see Trolltech task ID: 169502)
|
|
||||||
// 3) Qt >= 4.4.2 (see Trolltech task ID: 215090)
|
|
||||||
if ( QFontDatabase::supportsThreadedFontRendering() )
|
if ( QFontDatabase::supportsThreadedFontRendering() )
|
||||||
setFeature( Threaded );
|
setFeature( Threaded );
|
||||||
userMutex();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XpsGenerator::~XpsGenerator()
|
XpsGenerator::~XpsGenerator()
|
||||||
|
|
Loading…
Add table
Reference in a new issue