Zim: Fix threads synchronization while full-text indexing

This commit is contained in:
Abs62 2018-03-08 16:32:05 +03:00
parent d3d978e7c9
commit b30dc0f1a5

4
zim.cc
View file

@ -985,6 +985,8 @@ void ZimDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration
{ {
if( Qt4x5::AtomicInt::loadAcquire( isCancelled ) ) if( Qt4x5::AtomicInt::loadAcquire( isCancelled ) )
throw exUserAbort(); throw exUserAbort();
Mutex::Lock _( zimMutex );
offsetsWithClusters.append( QPair< uint32_t, quint32 >( getArticleCluster( df, *it ), *it ) ); offsetsWithClusters.append( QPair< uint32_t, quint32 >( getArticleCluster( df, *it ), *it ) );
} }
@ -1096,6 +1098,8 @@ void ZimDictionary::sortArticlesOffsetsForFTS( QVector< uint32_t > & offsets,
{ {
if( Qt4x5::AtomicInt::loadAcquire( isCancelled ) ) if( Qt4x5::AtomicInt::loadAcquire( isCancelled ) )
return; return;
Mutex::Lock _( zimMutex );
offsetsWithClusters.append( QPair< uint32_t, quint32 >( getArticleCluster( df, *it ), *it ) ); offsetsWithClusters.append( QPair< uint32_t, quint32 >( getArticleCluster( df, *it ), *it ) );
} }