Fix crash/hang in Parser::newClosureName

The parser was updating a static std::map without a lock.
It looks like this is supposed to be local to a file anyway,
so add the map as a member of ParserBase.
Esse commit está contido em:
mwilliams
2013-05-26 17:25:32 -07:00
commit de Sara Golemon
commit 23919b915f
2 arquivos alterados com 2 adições e 2 exclusões
+1 -2
Ver Arquivo
@@ -53,8 +53,7 @@ std::string ParserBase::newClosureName(
}
name += funcName;
static std::map<std::string, int> s_seenClosures;
int id = ++s_seenClosures[name];
int id = ++m_seenClosures[name];
if (id > 1) {
// we've seen the same name before, uniquify
name = name + '#' + std::to_string(id);
+1
Ver Arquivo
@@ -199,6 +199,7 @@ protected:
bool m_nsFileScope;
std::string m_namespace; // current namespace
hphp_string_imap<std::string> m_aliases;
hphp_string_imap<int> m_seenClosures;
};
///////////////////////////////////////////////////////////////////////////////