From 5a518074bef01fea1cf5fdb3086097cc8668ae93 Mon Sep 17 00:00:00 2001 From: Chris Cooper Date: Wed, 22 Jun 2016 12:22:02 +1000 Subject: [PATCH] lock GDALTiler constructor otherwise transformed bounds can vary between threads --- src/GDALTiler.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/GDALTiler.cpp b/src/GDALTiler.cpp index 56d2bc0..041b77a 100644 --- a/src/GDALTiler.cpp +++ b/src/GDALTiler.cpp @@ -22,6 +22,7 @@ #include // std::abs #include // std::minmax #include // strlen +#include #include "gdal_priv.h" #include "gdalwarper.h" @@ -39,6 +40,11 @@ GDALTiler::GDALTiler(GDALDataset *poDataset, const Grid &grid, const TilerOption poDataset(poDataset), options(options) { + + // Transformed bounds can give slightly different results on different threads unless mutexed + static std::mutex mutex; + std::lock_guard lock(mutex); + // if the dataset is set we need to initialise the tile bounds and raster // resolution from it. if (poDataset != NULL) {