diff --git a/gls.cc b/gls.cc
index be067788..c66a3085 100644
--- a/gls.cc
+++ b/gls.cc
@@ -1535,6 +1535,7 @@ void GlsResourceRequest::run()
memcpy( &data.front(), bytes.constData(), bytes.size() );
}
+ Mutex::Lock _( dataMutex );
hasAnyData = true;
}
catch( std::exception &ex )
diff --git a/mdx.cc b/mdx.cc
index b954374c..80c63752 100644
--- a/mdx.cc
+++ b/mdx.cc
@@ -697,13 +697,13 @@ void MdxArticleRequest::run()
""
"";
articleText += "
" + articleBody + cleaner + "
\n";
- hasAnyData = true;
}
- if ( hasAnyData )
+ if ( !articleText.empty() )
{
Mutex::Lock _( dataMutex );
data.insert( data.end(), articleText.begin(), articleText.end() );
+ hasAnyData = true;
}
finish();
diff --git a/slob.cc b/slob.cc
index 595ef886..d207f33b 100644
--- a/slob.cc
+++ b/slob.cc
@@ -1624,6 +1624,8 @@ void SlobResourceRequest::run()
QString css = QString::fromUtf8( resource.data(), resource.size() );
dict.isolateCSS( css, ".slobdict" );
QByteArray bytes = css.toUtf8();
+
+ Mutex::Lock _( dataMutex );
data.resize( bytes.size() );
memcpy( &data.front(), bytes.constData(), bytes.size() );
}
@@ -1666,6 +1668,7 @@ void SlobResourceRequest::run()
memcpy( &data.front(), resource.data(), data.size() );
}
+ Mutex::Lock _( dataMutex );
hasAnyData = true;
}
catch( std::exception &ex )
diff --git a/stardict.cc b/stardict.cc
index 9363d7dc..9b713fff 100644
--- a/stardict.cc
+++ b/stardict.cc
@@ -1905,6 +1905,7 @@ void StardictResourceRequest::run()
memcpy( &data.front(), bytes.constData(), bytes.size() );
}
+ Mutex::Lock _( dataMutex );
hasAnyData = true;
}
catch( std::exception &ex )
diff --git a/zim.cc b/zim.cc
index e1e3c8e1..596b6d22 100644
--- a/zim.cc
+++ b/zim.cc
@@ -1446,6 +1446,8 @@ void ZimResourceRequest::run()
QString css = QString::fromUtf8( resource.data(), resource.size() );
dict.isolateCSS( css, ".zimdict" );
QByteArray bytes = css.toUtf8();
+
+ Mutex::Lock _( dataMutex );
data.resize( bytes.size() );
memcpy( &data.front(), bytes.constData(), bytes.size() );
}
@@ -1488,6 +1490,7 @@ void ZimResourceRequest::run()
memcpy( &data.front(), resource.data(), data.size() );
}
+ Mutex::Lock _( dataMutex );
hasAnyData = true;
}
catch( std::exception &ex )