don't do concurrent access to a static member variable

in situations where the renderer is used from multiple threads, this causes memory corruption.

fixes mapbox/node-mapbox-gl-native#7
This commit is contained in:
Konstantin Käfer
2014-10-08 15:27:33 +02:00
parent 36b7bb0c09
commit 91f40daa69
4 changed files with 39 additions and 12 deletions

View File

@@ -23,7 +23,7 @@ void StyleLayer::setClasses(const std::vector<std::string> &class_names, const t
for (auto it = class_names.rbegin(); it != class_names.rend(); it++) {
const std::string &class_name = *it;
// From here on, we're only dealing with IDs to avoid comparing strings all the time.
const ClassID class_id = ClassDictionary::Lookup(class_name);
const ClassID class_id = ClassDictionary::Get().lookup(class_name);
applyClassProperties(class_id, already_applied, now, defaultTransition);
}