75614ac113
- update to 8.0.1: See https://www.kicad.org/blog/2024/03/KiCad-8.0.1-Release/ for details - Fix some race condition, causing e.g. fails in qa_pcbnew: * fix_zone_fill_race.patch * 0001-Fix-triangulationValid-check-race-for-zone-fill.patch OBS-URL: https://build.opensuse.org/request/show/1158253 OBS-URL: https://build.opensuse.org/package/show/electronics/kicad?expand=0&rev=130
54 lines
2.2 KiB
Diff
54 lines
2.2 KiB
Diff
From 81cb6d0c3fb92dd15f0a0e0d2d32337be1617399 Mon Sep 17 00:00:00 2001
|
|
From: Seth Hillbrand <seth@kipro-pcb.com>
|
|
Date: Wed, 13 Mar 2024 10:33:43 -0700
|
|
Subject: [PATCH] Fix race condition in zone fill
|
|
|
|
When checking collisions, the SHAPE_POLY_SET::Collide() routine is not
|
|
const because it will regenerate the triangulation cache if it is out of
|
|
date (using a const_cast, grrr). This sidesteps the issue by assigning
|
|
a mutex to the triangulation caching
|
|
|
|
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17180
|
|
---
|
|
libs/kimath/include/geometry/shape_poly_set.h | 4 +++-
|
|
libs/kimath/src/geometry/shape_poly_set.cpp | 1 +
|
|
2 files changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/libs/kimath/include/geometry/shape_poly_set.h b/libs/kimath/include/geometry/shape_poly_set.h
|
|
index 9ba7b5407b0..ac5b2325744 100644
|
|
--- a/libs/kimath/include/geometry/shape_poly_set.h
|
|
+++ b/libs/kimath/include/geometry/shape_poly_set.h
|
|
@@ -32,6 +32,7 @@
|
|
#include <deque> // for deque
|
|
#include <iosfwd> // for string, stringstream
|
|
#include <memory>
|
|
+#include <mutex>
|
|
#include <set> // for set
|
|
#include <stdexcept> // for out_of_range
|
|
#include <stdlib.h> // for abs
|
|
@@ -1537,7 +1538,8 @@ protected:
|
|
std::vector<POLYGON> m_polys;
|
|
std::vector<std::unique_ptr<TRIANGULATED_POLYGON>> m_triangulatedPolys;
|
|
|
|
- bool m_triangulationValid = false;
|
|
+ bool m_triangulationValid = false;
|
|
+ std::mutex m_triangulationMutex;
|
|
|
|
private:
|
|
MD5_HASH m_hash;
|
|
diff --git a/libs/kimath/src/geometry/shape_poly_set.cpp b/libs/kimath/src/geometry/shape_poly_set.cpp
|
|
index 407c43b9c6e..dacc1e8a07c 100644
|
|
--- a/libs/kimath/src/geometry/shape_poly_set.cpp
|
|
+++ b/libs/kimath/src/geometry/shape_poly_set.cpp
|
|
@@ -2984,6 +2984,7 @@ static SHAPE_POLY_SET partitionPolyIntoRegularCellGrid( const SHAPE_POLY_SET& aP
|
|
void SHAPE_POLY_SET::cacheTriangulation( bool aPartition, bool aSimplify,
|
|
std::vector<std::unique_ptr<TRIANGULATED_POLYGON>>* aHintData )
|
|
{
|
|
+ std::unique_lock<std::mutex> lock( m_triangulationMutex );
|
|
bool recalculate = !m_hash.IsValid();
|
|
MD5_HASH hash;
|
|
|
|
--
|
|
GitLab
|
|
|