gui: PreviewGeneratorPdf: Guard cache lookup with mutex
No guarantes the read-only lookup is thread-safe so better just lock there too
Tá an tiomantas seo le fáil i:
		@@ -7,10 +7,12 @@ static QMutex cacheMutex;
 | 
			
		||||
 | 
			
		||||
Poppler::Document *PreviewGeneratorPdf::document(QString path)
 | 
			
		||||
{
 | 
			
		||||
	QMutexLocker locker(&cacheMutex);
 | 
			
		||||
	if(documentcache.contains(path))
 | 
			
		||||
	{
 | 
			
		||||
		return documentcache.value(path);
 | 
			
		||||
	}
 | 
			
		||||
	locker.unlock();
 | 
			
		||||
	Poppler::Document *result = Poppler::Document::load(path);
 | 
			
		||||
	if(result == nullptr)
 | 
			
		||||
	{
 | 
			
		||||
@@ -19,7 +21,7 @@ Poppler::Document *PreviewGeneratorPdf::document(QString path)
 | 
			
		||||
	}
 | 
			
		||||
	result->setRenderHint(Poppler::Document::TextAntialiasing);
 | 
			
		||||
 | 
			
		||||
	QMutexLocker locker(&cacheMutex);
 | 
			
		||||
	locker.relock();
 | 
			
		||||
	documentcache.insert(path, result);
 | 
			
		||||
	locker.unlock();
 | 
			
		||||
	return result;
 | 
			
		||||
 
 | 
			
		||||
		Tagairt in Eagrán Nua
	
	Cuir bac ar úsáideoir