concurrent excepton

This commit is contained in:
Xiao YiFang 2022-06-18 16:24:30 +08:00
parent ff5e3b5778
commit f65d47602a

20
mdx.cc
View file

@ -911,14 +911,20 @@ void MdxDictionary::loadArticle( uint32_t offset, string & articleText, bool noF
QString articleId;
articleId.setNum( ( quint64 )pRecordInfo, 16 );
ScopedMemMap compressed( dictFile, recordInfo.compressedBlockPos, recordInfo.compressedBlockSize );
if ( !compressed.startAddress() )
throw exCorruptDictionary();
QByteArray decompressed;
if ( !MdictParser::parseCompressedBlock( recordInfo.compressedBlockSize, ( char * )compressed.startAddress(),
recordInfo.decompressedBlockSize, decompressed ) )
throw exCorruptDictionary();
{
Mutex::Lock _( idxMutex );
ScopedMemMap compressed( dictFile, recordInfo.compressedBlockPos, recordInfo.compressedBlockSize );
if( !compressed.startAddress() )
throw exCorruptDictionary();
if( !MdictParser::parseCompressedBlock( recordInfo.compressedBlockSize,
(char *)compressed.startAddress(),
recordInfo.decompressedBlockSize,
decompressed ) )
throw exCorruptDictionary();
}
QString article = MdictParser::toUtf16( encoding.c_str(),
decompressed.constData() + recordInfo.recordOffset,