threadsafety: Fix static data in Token::values()

This commit is contained in:
Daniel Marjamäki 2017-08-13 14:15:24 +02:00
parent 31ef266036
commit ca6109b40c
2 changed files with 4 additions and 2 deletions

View File

@ -33,6 +33,8 @@
#include <stack>
#include <utility>
const std::list<ValueFlow::Value> Token::emptyValueList;
Token::Token(Token **tokens) :
tokensBack(tokens),
_next(nullptr),

View File

@ -746,8 +746,7 @@ public:
}
const std::list<ValueFlow::Value>& values() const {
static const std::list<ValueFlow::Value> emptyList;
return _values ? *_values : emptyList;
return _values ? *_values : emptyValueList;
}
/**
@ -925,6 +924,7 @@ private:
// ValueFlow
std::list<ValueFlow::Value>* _values;
static const std::list<ValueFlow::Value> emptyValueList;
public:
void astOperand1(Token *tok);