Skip to content

Commit

Permalink
Merge pull request #678 from systemed/shp_threads
Browse files Browse the repository at this point in the history
Fix thread safety issue with shapefile index
  • Loading branch information
systemed authored Feb 11, 2024
2 parents b1369ab + cf7ea88 commit 8156369
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/shp_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ void ShpProcessor::read(class LayerDef &layer, uint layerNum)
// process attributes
string name;
bool hasName = false;
if (indexField>-1) { name=DBFReadStringAttribute(dbf, i, indexField); hasName = true;}
if (indexField>-1) {
std::lock_guard<std::mutex> lock(attributeMutex);
name=DBFReadStringAttribute(dbf, i, indexField); hasName = true;
}
AttributeIndex attrIdx = readShapefileAttributes(dbf, i, columnMap, columnTypeMap, layer, layer.minzoom);
// process geometry
processShapeGeometry(shape, attrIdx, layer, layerNum, hasName, name);
Expand Down

0 comments on commit 8156369

Please sign in to comment.