From df94e2ee80bad228fce4032658d95962cce8e434 Mon Sep 17 00:00:00 2001 From: Abs62 Date: Mon, 21 Apr 2014 00:02:41 +0400 Subject: [PATCH] Fix some crashes --- bgl.cc | 1 + dictdfiles.cc | 6 +++++- mdx.cc | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bgl.cc b/bgl.cc index 7ec1d92d..127db83a 100644 --- a/bgl.cc +++ b/bgl.cc @@ -417,6 +417,7 @@ namespace dictionaryDescription = "NONE"; else { + Mutex::Lock _( idxMutex ); vector< char > chunk; char * dictDescription = chunks.getBlock( idxHeader.descriptionAddress, chunk ); string str( dictDescription ); diff --git a/dictdfiles.cc b/dictdfiles.cc index 83ac623a..4390562d 100644 --- a/dictdfiles.cc +++ b/dictdfiles.cc @@ -491,7 +491,11 @@ void DictdDictionary::getArticleText( uint32_t articleAddress, QString & headwor string articleText; - char * articleBody = dict_data_read_( dz, articleOffset, articleSize, 0, 0 ); + char * articleBody; + { + Mutex::Lock _( dzMutex ); + articleBody = dict_data_read_( dz, articleOffset, articleSize, 0, 0 ); + } if ( !articleBody ) { diff --git a/mdx.cc b/mdx.cc index 8a5ad72c..2779f5b1 100644 --- a/mdx.cc +++ b/mdx.cc @@ -886,6 +886,7 @@ const QString & MdxDictionary::getDescription() } else { + Mutex::Lock _( idxMutex ); vector< char > chunk; char * dictDescription = chunks.getBlock( idxHeader.descriptionAddress, chunk ); string str( dictDescription );