summaryrefslogtreecommitdiffstats
path: root/src/code.l
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-11-28 15:14:32 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-11-28 15:14:32 (GMT)
commitf651a0ac32060907b43eb6ccc7f1472986034270 (patch)
tree522b39dadd7f82f7362c9168d44627493f556315 /src/code.l
parent06eb8c6edcb0df79717f9cf3afb4061b57157382 (diff)
downloadDoxygen-f651a0ac32060907b43eb6ccc7f1472986034270.zip
Doxygen-f651a0ac32060907b43eb6ccc7f1472986034270.tar.gz
Doxygen-f651a0ac32060907b43eb6ccc7f1472986034270.tar.bz2
Protect mutable access to members in code generators with mutexes
Diffstat (limited to 'src/code.l')
-rw-r--r--src/code.l6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/code.l b/src/code.l
index 1b6cf42..df4dd53 100644
--- a/src/code.l
+++ b/src/code.l
@@ -244,6 +244,8 @@ static void addVariable(yyscan_t yyscanner,QCString type,QCString name);
static std::mutex g_searchIndexMutex;
static std::mutex g_docCrossReferenceMutex;
+static std::mutex g_addExampleMutex;
+static std::mutex g_countFlowKeywordsMutex;
/* -----------------------------------------------------------------
*/
@@ -2447,6 +2449,7 @@ static void codifyLines(yyscan_t yyscanner,const char *text)
static void incrementFlowKeyWordCount(yyscan_t yyscanner)
{
+ std::lock_guard<std::mutex> lock(g_countFlowKeywordsMutex);
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
{
@@ -2733,6 +2736,7 @@ static bool getLinkInScope(yyscan_t yyscanner,
//printf("found it %s!\n",md->qualifiedName().data());
if (yyextra->exampleBlock)
{
+ std::lock_guard<std::mutex> lock(g_addExampleMutex);
QCString anchor;
anchor.sprintf("a%d",yyextra->anchorCount);
//printf("addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(),
@@ -2899,6 +2903,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
DBG_CTX((stderr,"is linkable class %s\n",clName));
if (yyextra->exampleBlock)
{
+ std::lock_guard<std::mutex> lock(g_addExampleMutex);
QCString anchor;
anchor.sprintf("_a%d",yyextra->anchorCount);
//printf("addExampleClass(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(),
@@ -2989,6 +2994,7 @@ static bool generateClassMemberLink(yyscan_t yyscanner,
if (yyextra->exampleBlock)
{
+ std::lock_guard<std::mutex> lock(g_addExampleMutex);
QCString anchor;
anchor.sprintf("a%d",yyextra->anchorCount);
//printf("addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(),