From ab8b1d39bdc4b47eb3e5a00a186a2c4b7f27f29b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Garc=C3=ADa=20Li=C3=B1=C3=A1n?= Date: Tue, 11 Jun 2019 23:05:09 +0200 Subject: [PATCH] Fixed undetected compiler error due to gcc accepting variable-length arrays --- simgear/scene/viewer/ClusteredShading.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/simgear/scene/viewer/ClusteredShading.cxx b/simgear/scene/viewer/ClusteredShading.cxx index dcd13720..e42883a2 100644 --- a/simgear/scene/viewer/ClusteredShading.cxx +++ b/simgear/scene/viewer/ClusteredShading.cxx @@ -253,12 +253,12 @@ ClusteredShading::update(const SGLightList &light_list) // Again, avoid the unnecessary threading overhead threadFunc(0); } else { - std::thread light_threads[_num_threads]; + std::vector threads; + threads.reserve(_num_threads); for (int i = 0; i < _num_threads; ++i) - light_threads[i] = std::thread(&ClusteredShading::threadFunc, this, i); + threads.emplace_back(&ClusteredShading::threadFunc, this, i); - for (int i = 0; i < _num_threads; ++i) - light_threads[i].join(); + for (auto &t : threads) t.join(); } // Force upload of the image data