mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
add mutex to scopedmemmap
This commit is contained in:
parent
3c02fb7499
commit
4edd3b3987
|
@ -807,6 +807,7 @@ void FTSResultsRequest::combinedIndexSearch( BtreeIndexing::BtreeIndex & ftsInde
|
|||
{
|
||||
if( Utils::AtomicInt::loadAcquire( isCancelled ) )
|
||||
{
|
||||
Mutex::Lock _( dataMutex );
|
||||
sets << tmp;
|
||||
return;
|
||||
}
|
||||
|
|
14
mdx.cc
14
mdx.cc
|
@ -173,18 +173,24 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
QByteArray decompressed;
|
||||
|
||||
{
|
||||
Mutex::Lock _( idxMutex );
|
||||
ScopedMemMap compressed( mddFile, indexEntry.compressedBlockPos, indexEntry.compressedBlockSize );
|
||||
if ( !compressed.startAddress() )
|
||||
if( !compressed.startAddress() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray decompressed;
|
||||
if ( !MdictParser::parseCompressedBlock( indexEntry.compressedBlockSize, ( char * )compressed.startAddress(),
|
||||
indexEntry.decompressedBlockSize, decompressed ) )
|
||||
if( !MdictParser::parseCompressedBlock( indexEntry.compressedBlockSize,
|
||||
(char *)compressed.startAddress(),
|
||||
indexEntry.decompressedBlockSize,
|
||||
decompressed ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
result.resize( indexEntry.recordSize );
|
||||
memcpy( &result.front(), decompressed.constData() + indexEntry.recordOffset, indexEntry.recordSize );
|
||||
|
|
Loading…
Reference in a new issue